Bump actions/download-artifact from 1 to 4.1.7 in /.github/workflows #19
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: push | |
jobs: | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Create draft release | |
uses: actions/[email protected] | |
if: github.ref == 'refs/heads/master' | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
const fs = require('fs'); | |
const release = await github.repos.createRelease({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
tag_name: new Date().toISOString().replace(/[T:]/g, '-').split('.')[0], | |
target_commitish: context.sha, | |
draft: true, | |
prerelease: true, | |
}); | |
fs.mkdirSync('release-info'); | |
fs.writeFileSync('release-info/release.json', JSON.stringify({ | |
id: release.data.id, | |
upload_url: release.data.upload_url, | |
})); | |
- name: Upload release-info | |
uses: actions/upload-artifact@v1 | |
if: github.ref == 'refs/heads/master' | |
with: | |
name: release-info | |
path: release-info | |
build: | |
name: ${{ matrix.wheel }} | |
runs-on: ubuntu-latest | |
needs: release | |
container: | |
image: debian:11 | |
strategy: | |
matrix: | |
wheel: | |
- ns-3 | |
- traci | |
fail-fast: false | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Execute ${{ matrix.wheel }}/build.sh | |
run: exec ./github-action-build.sh ${{ matrix.wheel }}/build.sh | |
- name: Download release-info | |
uses: actions/[email protected] | |
if: github.ref == 'refs/heads/master' | |
with: | |
name: release-info | |
- name: Upload ${{ matrix.wheel }} | |
uses: actions/[email protected] | |
if: github.ref == 'refs/heads/master' | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
const fs = require('fs'); | |
const release = JSON.parse(fs.readFileSync('release-info/release.json'), 'utf8'); | |
for (let i = 0; ; i++) { | |
const path = process.env[`ASSET_PATH_${i}`]; | |
if (!path) { | |
break; | |
} | |
const name = process.env[`ASSET_NAME_${i}`]; | |
const data = fs.readFileSync(path); | |
console.log(`Upload ${name}: ${path} (${data.length} bytes)`); | |
await github.repos.uploadReleaseAsset({ | |
url: release.upload_url, | |
headers: { | |
'content-type': 'application/zip', | |
'content-length': data.length, | |
}, | |
name, | |
data, | |
}); | |
} | |
publish: | |
name: Publish | |
runs-on: ubuntu-latest | |
needs: build | |
if: github.ref == 'refs/heads/master' | |
steps: | |
- name: Download release-info | |
uses: actions/[email protected] | |
with: | |
name: release-info | |
- name: Publish release | |
uses: actions/[email protected] | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
const fs = require('fs'); | |
const release = JSON.parse(fs.readFileSync('release-info/release.json'), 'utf8'); | |
await github.repos.updateRelease({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
release_id: release.id, | |
draft: false, | |
}); |