Skip to content

Release

Release #71

Workflow file for this run

name: Release
on:
workflow_run:
workflows: [ Build and test ]
types: [ completed ]
branches: [ master ]
jobs:
release:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout repository code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Check version
run: (tools/version -C && echo "RELEASE=1" || echo "RELEASE=") >> "$GITHUB_ENV"
- name: Create artifacts directory
if: ${{env.RELEASE == '1'}}
run: |
ARTIFACTS=$GITHUB_WORKSPACE/artifacts
mkdir -p "$ARTIFACTS"
echo "ARTIFACTS=$ARTIFACTS" >> "$GITHUB_ENV"
- name: Download artifacts
if: ${{env.RELEASE == '1'}}
uses: actions/github-script@v6
with:
script: |
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id,
});
let matchedArtifacts = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name.startsWith("PKGBUILD") || artifact.name.startsWith("source-package")
});
let fs = require('fs');
for(const artifact of matchedArtifacts) {
let download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: artifact.id,
archive_format: 'zip',
});
console.log(`${process.env.ARTIFACTS}/${artifact.name}.zip`)
fs.writeFileSync(`${process.env.ARTIFACTS}/${artifact.name}.zip`, Buffer.from(download.data));
}
- name: Create release
if: ${{env.RELEASE == '1'}}
run: .github/release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}