fix: reorder checkout to not overwrite #76
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
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
build: | |
outputs: | |
next: ${{ steps.get-version.outputs.next }} | |
bump: ${{ steps.get-version.outputs.bump }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get Next version | |
id: get-version | |
uses: ietf-tools/[email protected] | |
with: | |
token: ${{ github.token }} | |
branch: ${{ github.ref }} | |
noVersionBumpBehavior: 'current' | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.18 | |
- name: Make build folder | |
run: mkdir build | |
- name: Update version in main.go | |
shell: bash | |
run: | | |
new_version=${{ steps.get-version.outputs.nextStrict }} | |
sed -i "s/const version = \"[0-9]*\.[0-9]*\.[0-9]*\"/const version = \"$new_version\"/g" ${{ github.workspace }}/main.go | |
- name: Build for Windows (amd64) | |
run: | | |
env GOOS=windows GOARCH=amd64 go build -o /home/runner/work/wowtools/wowtools/build/wowtools.exe | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: WoWTools-AMD64 | |
path: | | |
build/wowtools.exe | |
release: | |
runs-on: ubuntu-latest | |
needs: build | |
if: ${{ needs.build.outputs.bump != '' && github.ref == 'refs/heads/main' }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Download Windows Artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
name: WoWTools-AMD64 | |
- name: Create Release | |
shell: bash | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: > | |
gh release create ${{ needs.build.outputs.next }} | |
wowtools.exe | |
--title ${{ needs.build.outputs.next }} | |
--generate-notes --notes-start-tag | |
${{ needs.build.outputs.next }} |