Skip to content

Fix the ISO name

Fix the ISO name #8

Workflow file for this run

name: Create Release on Version Update
on:
push:
branches:
- 'master'
jobs:
create-release:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Compare current release with VERSION file
id: compare_versions
run: |
if [ "$(gh release view -q '.tagName' --json tagName)" == "$(cat VERSION)" ]; then
echo "No new release to generate!"
echo "NEW_RELEASE=0" >> $GITHUB_ENV
exit
fi
# Apparently the tag still exists when the release is deleted from GitHub web interface...
# Also mock the exit status so that it always returns with code 0.
git push --delete origin refs/tags/$(cat VERSION) || true
echo "NEW_RELEASE=1" >> $GITHUB_ENV
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build ISO
id: build_iso
if: ${{ env.NEW_RELEASE == '1' }}
run: |
files="$(cat FILES.txt | tr '\n' ' ')"
echo "The password for both Linda and Sara are \"notarealpw\"." > password.txt
echo "See resources.txt to see how to change this within autounattend.xml." >> password.txt
xorriso -as mkisofs -r -J --joliet-long -V 'STDU_GH' -o STDU-GH.iso -partition_offset 16 $files password.txt
echo "ISO_PATH=$(pwd)/STDU-GH.iso" >> $GITHUB_ENV
- name: Run catalog script
id: run_script
if: ${{ env.NEW_RELEASE == '1' }}
run: |
# Execute the script and save the output
if [ -x scripts/GetCatalog.sh ]; then
GH_TOKEN=$GH_TOKEN ./scripts/GetCatalog.sh > release_notes.md
elif [ -f scripts/GetCatalog.sh ]; then
chmod +x scripts/GetCatalog.sh
GH_TOKEN=$GH_TOKEN ./scripts/GetCatalog.sh > release_notes.md
else
echo "scripts/GetCatalog.sh is not executable or not found"
exit 1
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create tag
id: create_tag
if: ${{ env.NEW_RELEASE == '1' }}
run: |
# Generate a new tag based on the version
TAG_NAME=$(cat VERSION)
git tag $TAG_NAME
git push origin $TAG_NAME
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
- name: Output release notes
id: output_release_notes
if: ${{ env.NEW_RELEASE == '1' }}
run: |
echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
cat release_notes.md >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Create release
id: create_release
if: ${{ env.NEW_RELEASE == '1' }}
uses: actions/create-release@v1
with:
tag_name: ${{ env.TAG_NAME }}
release_name: ${{ env.TAG_NAME }} # No "Release" prefix here
body: ${{ env.RELEASE_NOTES }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload ISO
id: upload_iso
if: ${{ env.NEW_RELEASE == '1' }}
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ env.ISO_PATH }}
asset_name: STDUnattended_GH_${{ env.TAG_NAME }}.iso
asset_content_type: application/octet-stream
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}