build and release #39
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 and release | |
on: | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}-iso | |
cancel-in-progress: true | |
jobs: | |
build-iso: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: DeterminateSystems/nix-installer-action@v14 | |
- uses: DeterminateSystems/magic-nix-cache-action@v8 | |
- name: build ISO | |
run: | | |
nix build .#iso -L | |
mkdir iso || true | |
ISO=$(head -n1 result/nix-support/hydra-build-products | cut -d'/' -f6) | |
sudo mv "result/iso/${ISO}" iso/${ISO} | |
sha256sum "iso/${ISO}" > "iso/${ISO}.sha256" | |
sed -i -r "s/ .*\/(.+)/ \1/g" "iso/${ISO}.sha256" | |
- name: Upload | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
for artefact in "iso/"*; do | |
gh release upload "${{ github.ref }}" "${artefact}" --clobber | |
done | |
- name: Release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
if [ "$(gh release view "${{ github.ref }}" --json assets --template '{{len .assets}}')" -lt 0 ]; then | |
exit 1 | |
fi | |
gh release edit "${{ github.ref }}" --draft=false |