diff --git a/.github/workflows/publish-release-to-github.yaml b/.github/workflows/publish-release-to-github.yaml index 2503fb816c..0c0452b8f5 100644 --- a/.github/workflows/publish-release-to-github.yaml +++ b/.github/workflows/publish-release-to-github.yaml @@ -1,4 +1,4 @@ -name: Publish release to GitHub +name: 'RELEASE: Publish to GitHub' on: workflow_dispatch: @@ -7,6 +7,10 @@ jobs: publish-release-to-github: name: Publish release to GitHub runs-on: Ubuntu-22.04 + permissions: + contents: write + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - name: Checkout @@ -20,6 +24,11 @@ jobs: - name: Install dependencies run: npm ci + - name: Set up Git + run: | + git config user.name 'github-actions[bot]' + git config user.email 'github-actions[bot]@users.noreply.github.com' + - name: Create GitHub tag id: create-github-tag run: | @@ -31,14 +40,14 @@ jobs: exit 1 else echo "🗒 Tagging repo using tag version: $TAG ..." - git tag $TAG -m "GOV.UK Frontend release $TAG" - git push --tags + git tag -a $TAG -m "GOV.UK Frontend release $TAG" + git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} --tags echo "🗒 Tag $TAG created and pushed to remote." echo "GH_TAG=${TAG}" >> $GITHUB_OUTPUT fi - name: Create GitHub archive - run: git archive -o ./release-${{ steps.create-github-tag.GH_TAG }}.zip HEAD:dist + run: git archive -o ./release-${{ steps.create-github-tag.outputs.GH_TAG }}.zip HEAD:dist - name: Generate release notes uses: actions/github-script@v7.0.1 @@ -49,10 +58,9 @@ jobs: await generateReleaseNotes() - name: Create GitHub release - uses: ncipollo/release-action@v1 - with: - name: GOV.UK Frontend ${{ steps.create-github-tag.GH_TAG }} - artifacts: release-${{ steps.create-github-tag.GH_TAG }}.zip - bodyFile: release-notes-body - tag: ${{ steps.create-github-tag.GH_TAG }} - draft: true + run: | + GH_TAG=${{ steps.create-github-tag.outputs.GH_TAG }} + RELEASE_NAME="GOV.UK Frontend $GH_TAG" + RELEASE_BODY=$(cat release-notes-body) + + gh release create "$GH_TAG" ./release-"${GH_TAG}".zip --title "GOV.UK Frontend ${RELEASE_NAME}" --notes "$RELEASE_BODY" --draft