Skip to content

Experiments

Experiments #24

Workflow file for this run

name: Experiments
on:
workflow_dispatch
jobs:
experiments:
outputs:
# accessible from other jobs as ${{needs.experiments.outputs.version}}
version: ${{steps.version.outputs.version}}
runs-on: windows-latest
steps:
# - name: Checkout
# uses: actions/checkout@v4
# with:
# submodules: 'true'
- name: Print environment
shell: cmd
run: |
echo ----------------------------------------------------
set
echo ----------------------------------------------------
where gcc.exe
gcc.exe -v
echo ====================================================
py -0p
echo ----------------------------------------------------
py -3 -V
py -3 -m pip list
- id: version
name: Version
shell: python
run: |
import os
from datetime import datetime, timezone
date = datetime.now(tz=timezone.utc)
with open(os.getenv('GITHUB_OUTPUT'), "a") as fout:
print( f"version={date.year%100}.{date.month}.{date.day}.${{github.run_number}}")
fout.write(f"version={date.year%100}.{date.month}.{date.day}.${{github.run_number}}")
- name: Print version
shell: cmd
run: |
echo -- version is ${{steps.version.outputs.version}}
results:
runs-on: windows-latest
needs: experiments
steps:
- name: Print version
shell: cmd
run: |
echo previous version=${{needs.experiments.outputs.version}}
release:
runs-on: ubuntu-latest
needs: experiments
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download artifacts
shell: python
run: |
with open("test.txt", "w") as fout:
fout.write(f"Artifact sample for version ${{needs.experiments.outputs.version}}")
- name: Prepare release notes
shell: python
run: |
lines = []
with open(".github/workflows/release-body.md") as fin:
line = fin.read()
#line = line.replace('{version-libs}', 'libcurl/todo, OpenSSL/todo, zlib/todo, brotli/todo, zstd/todo, nghttp2/todo')
#line = line.replace('{version-gcc}', 'todo')
line = line.replace('{url-workflow}', 'https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}')
lines.append(line)
with open(".github/workflows/release-body.md", "w") as fout:
for line in lines:
fout.write(line)
- uses: ncipollo/release-action@v1
with:
# note: `tag` is the release key
tag: release-candidate
name: v${{needs.experiments.outputs.version}}
artifacts: "test.txt"
bodyFile: .github/workflows/release-body.md
draft: true
makeLatest: true
allowUpdates: true
updateOnlyUnreleased: true
artifactErrorsFailBuild: true
replacesArtifacts: true
jsons:
runs-on: ubuntu-latest
steps:
- name: Read versions.json
id: versions
shell: python
run: |
import os
with open('versions.json", 'w') as fout:
fout.write('{"value1":1, "value2":"2"}')
with open('versions.json') as fin:
with open(os.getenv('GITHUB_OUTPUT'), "a") as fout:
fout.write(f"versions_json={fin.read()}")
- name: Use versions.json
shell: python
run: print(${{fromJson(steps.versions.outputs.versions_json).value2}})