diff --git a/.gitea/workflows/actions.yaml b/.gitea/workflows/actions.yaml index c23ef66..696f59d 100644 --- a/.gitea/workflows/actions.yaml +++ b/.gitea/workflows/actions.yaml @@ -2,51 +2,47 @@ name: build-image on: [push] jobs: - # semrel_dryrun: - # name: Semantic Release (Dry-run) - # runs-on: ubuntu-latest - # outputs: - # version: ${{ steps.sem_rel.outputs.version }} - # steps: - # - name: Check out repository code - # uses: actions/checkout@v3 - # - name: Set up Node - # uses: actions/setup-node@v3 - # with: - # node-version: 20 - # - name: Install dependencies - # run: | - # npm install \ - # semantic-release \ - # @semantic-release/commit-analyzer \ - # @semantic-release/exec - # - name: Semantic Release (dry-run) - # id: sem_rel - # run: | - # npx semantic-release \ - # --package @semantic-release/exec \ - # --package semantic-release \ - # --branches ${{ gitea.refname }} \ - # --tag-format 'v${version}' \ - # --dry-run \ - # --plugins @semantic-release/commit-analyzer,@semantic-release/exec \ - # --analyzeCommits @semantic-release/commit-analyzer \ - # --verifyRelease @semantic-release/exec \ - # --verifyReleaseCmd 'echo "version=${nextRelease.version}" >> $GITHUB_OUTPUT' - # env: - # GIT_CREDENTIALS: ${{ secrets.GIT_USERNAME }}:${{ secrets.GIT_APIKEY }} - # - name: Assert semantic release output - # run: | - # [[ -z "${{ steps.sem_rel.outputs.version }}" ]] && { - # echo 'No release tag - exiting'; exit 1 - # } || { - # echo 'Release tag set correctly: ${{ steps.sem_rel.outputs.version }}'; exit 0 - # } + semrel_dryrun: + name: Semantic Release (Dry-run) + runs-on: ubuntu-latest + outputs: + version: ${{ steps.sem_rel.outputs.version }} + steps: + - name: Check out repository code + uses: actions/checkout@v3 + - name: Install dependencies + run: | + npm install \ + semantic-release \ + @semantic-release/commit-analyzer \ + @semantic-release/exec + - name: Semantic Release (dry-run) + id: sem_rel + run: | + npx semantic-release \ + --package @semantic-release/exec \ + --package semantic-release \ + --branches ${{ gitea.refname }} \ + --tag-format 'v${version}' \ + --dry-run \ + --plugins @semantic-release/commit-analyzer,@semantic-release/exec \ + --analyzeCommits @semantic-release/commit-analyzer \ + --verifyRelease @semantic-release/exec \ + --verifyReleaseCmd 'echo "version=${nextRelease.version}" >> $GITHUB_OUTPUT' + env: + GIT_CREDENTIALS: ${{ secrets.GIT_USERNAME }}:${{ secrets.GIT_APIKEY }} + - name: Assert semantic release output + run: | + [[ -z "${{ steps.sem_rel.outputs.version }}" ]] && { + echo 'No release tag - exiting'; exit 1 + } || { + echo 'Release tag set correctly: ${{ steps.sem_rel.outputs.version }}'; exit 0 + } build_image: name: Build image runs-on: ubuntu-latest - # needs: semrel_dryrun + needs: semrel_dryrun steps: - name: Check out repository code uses: actions/checkout@v4 @@ -71,10 +67,10 @@ jobs: run: | curl -L \ https://sn.itch.fyi/Repository/iso/Canonical/Ubuntu%20Server%2024.04/ubuntu-24.04-server-cloudimg-amd64.img \ - -o ubuntu-vm/ubuntu.img \ + -o ubuntu-vm/ubuntu_rke2_${{ needs.semrel_dryrun.outputs.version }}.img \ -u ${{ secrets.REPO_USERNAME }}:${{ secrets.REPO_PASSWORD }} - qemu-img resize ubuntu-vm/ubuntu.img +5G + qemu-img resize ubuntu-vm/ubuntu_rke2_${{ needs.semrel_dryrun.outputs.version }}.img +5G - name: Generate seed ISO run: | envsubst < cloud-init/user-data.template > cloud-init/user-data @@ -97,7 +93,7 @@ jobs: -m 3072 \ -smp 2 \ -cpu host \ - -drive file=ubuntu-vm/ubuntu.img,if=virtio,format=qcow2 \ + -drive file=ubuntu-vm/ubuntu_rke2_${{ needs.semrel_dryrun.outputs.version }}.img,if=virtio,format=qcow2 \ -drive file=ubuntu-vm/seed.iso,format=raw,media=cdrom \ -nographic \ -net nic \ @@ -106,7 +102,7 @@ jobs: -chardev socket,path=qga.sock,server=on,wait=off,id=qga0 \ -device virtserialport,chardev=qga0,name=org.qemu.guest_agent.0 - if ! guestfish --ro -a ubuntu-vm/ubuntu.img -i stat /var/log/template-generation-success; then + if ! guestfish --ro -a ubuntu-vm/ubuntu_rke2_${{ needs.semrel_dryrun.outputs.version }}.img -i stat /var/log/template-generation-success; then echo "VM provisioning encountered errors - exiting" exit 1 fi