outputting separate artifacts so that I can see all files #47
Workflow file for this run
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: emscripten | ||
on: | ||
push: | ||
pull_request: | ||
branches: [ master ] | ||
jobs: | ||
emscripten: | ||
strategy: | ||
matrix: | ||
target: [js, wasm] | ||
env: | ||
EMSCRIPTEN_VERSION: 3.1.47 | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
- name: Install emscripten | ||
working-directory: libheif | ||
run: | | ||
./scripts/install-ci-linux.sh | ||
- name: Prepare CI | ||
working-directory: libheif | ||
run: | | ||
./scripts/prepare-ci.sh | ||
- name: Run build and tests (JS) | ||
if: ${{ matrix.target=='js' }} | ||
working-directory: libheif | ||
run: | | ||
./scripts/run-ci.sh | ||
- name: Run build and tests (WASM) | ||
if: ${{ matrix.target=='wasm' }} | ||
working-directory: libheif | ||
run: | | ||
sed s/USE_WASM=0/USR_WASM=1/g ./scripts/run-ci.sh > ./scripts/run-ci-wasm.sh | ||
chmod +x ./scripts/run-ci-wasm.sh | ||
./scripts/run-ci-wasm.sh | ||
ls -la | ||
- name: Dist prep | ||
run: ./dist-prep.sh | ||
- name: Artifacts | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: ${{ matrix.target }} | ||
path: dist | ||
release: | ||
- name: Download build artifacts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
path: ./ | ||
- name: Flatten artifacts | ||
run: | | ||
ls -lR | ||
- name: Grouped Artifacts | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: all | ||
path: '.' | ||
- name: Release | ||
if: startsWith(github.ref, 'refs/tags/') && github.event_name != 'pull_request' | ||
uses: actions/github-script@v2 | ||
with: | ||
github-token: ${{secrets.GITHUB_TOKEN}} | ||
script: | | ||
const fs = require('fs').promises; | ||
console.log('environment', process.versions); | ||
const { repo: { owner, repo }, sha, ref } = context; | ||
console.log({ owner, repo, sha, ref }); | ||
const name = ref.replace('refs/tags/', ''); | ||
const release = await github.repos.createRelease({ | ||
owner, repo, name, | ||
tag_name: name, | ||
draft: true, | ||
target_commitish: sha | ||
}); | ||
console.log('created release', { release }); | ||
for (let file of await fs.readdir('./dist')) { | ||
console.log('uploading', file); | ||
await github.repos.uploadReleaseAsset({ | ||
owner, repo, | ||
release_id: release.data.id, | ||
name: file, | ||
data: await fs.readFile(`./dist/${file}`) | ||
}); | ||
} |