-
Notifications
You must be signed in to change notification settings - Fork 339
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
843e065
commit 55dbadb
Showing
1 changed file
with
19 additions
and
11 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/[email protected] | ||
|
@@ -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 |