Skip to content

Commit

Permalink
Update tag-and-release.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
georgepstaylor committed Nov 11, 2024
1 parent ddc59f7 commit fec096d
Showing 1 changed file with 53 additions and 47 deletions.
100 changes: 53 additions & 47 deletions .github/workflows/tag-and-release.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
---
name: "Release"
on:
pull_request:
types:
- closed
branches:
- main
- dev
paths-ignore:
- "readme.md"
- ".gitignore"
- ".gitattributes"
- ".vscode/**"
- ".idea/**"
- ".github/**"
pull_request:
types:
- closed
branches:
- main
- dev
paths-ignore:
- "readme.md"
- ".gitignore"
- ".gitattributes"
- ".vscode/**"
- ".idea/**"
- ".github/**"

jobs:
build:
Expand All @@ -22,38 +22,44 @@ jobs:
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.merge_commit_sha }}
fetch-depth: '0'
- name: release or prerelease
id: release_type
run: |
if [[ "${{ github.event.pull_request.base.ref }}" == "main" ]]; then
echo "This is a release"
echo "PRERELEASE=false" >> $GITHUB_OUTPUT
else
echo "This is a prerelease"
echo "PRERELEASE=true" >> $GITHUB_OUTPUT
fi
- name: Bump version and push tag
id: tag
uses: anothrNick/[email protected] # Don't use @master or @v1 unless you're happy to test the latest version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: true
PRERELEASE_SUFFIX: dev
PRERELEASE: "${{ steps.release_type.outputs.PRERELEASE }}"
- name: Create prerelease
if: steps.release_type.outputs.PRERELEASE == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create ${{ steps.tag.outputs.new_tag }} --title "Dev ${{ steps.tag.outputs.new_tag }}" --prerelease --generate-notes --verify-tag
- name: Create release
if: steps.release_type.outputs.PRERELEASE == 'false'
env:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.merge_commit_sha }}
fetch-depth: "0"
- name: release or prerelease
id: release_type
run: |
if [[ "${{ github.event.pull_request.base.ref }}" == "main" ]]; then
echo "This is a release"
echo "PRERELEASE=false" >> $GITHUB_OUTPUT
else
echo "This is a prerelease"
echo "PRERELEASE=true" >> $GITHUB_OUTPUT
fi
- name: Bump version and push tag
id: tag
uses: anothrNick/[email protected] # Don't use @master or @v1 unless you're happy to test the latest version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create ${{ steps.tag.outputs.new_tag }} --title "Release ${{ steps.tag.outputs.new_tag }}" --generate-notes --verify-tag
WITH_V: true
PRERELEASE_SUFFIX: dev
PRERELEASE: "${{ steps.release_type.outputs.PRERELEASE }}"
- name: Create prerelease
if: steps.release_type.outputs.PRERELEASE == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create ${{ steps.tag.outputs.new_tag }} --title "Dev ${{ steps.tag.outputs.new_tag }}" --prerelease --generate-notes --verify-tag
- name: Create release
if: steps.release_type.outputs.PRERELEASE == 'false'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create ${{ steps.tag.outputs.new_tag }} --title "Release ${{ steps.tag.outputs.new_tag }}" --generate-notes --verify-tag
- name: Trigger build from tag
if: steps.release_type.outputs.PRERELEASE == 'false'
uses: ./.github/workflows/image-build.yml
with:
tag: ${{ steps.tag.outputs.new_tag }}

0 comments on commit fec096d

Please sign in to comment.