fix(ci): Upload artifacts using unique names #33
Workflow file for this run
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
# .github/workflows/release.yaml | |
name: release | |
on: | |
push: | |
tags: | |
- "v*.*.*" | |
jobs: | |
meta: | |
runs-on: ubuntu-latest | |
outputs: | |
date: ${{ steps.meta.outputs.date }} | |
steps: | |
- name: Prepare release meta | |
id: meta | |
run: | | |
echo "::set-output name=date::$(date -u +'%Y-%m-%dT%H:%M:%SZ')" | |
build-binary: | |
name: Build Go binary | |
runs-on: ubuntu-latest | |
needs: | |
- meta | |
strategy: | |
matrix: | |
goarch: [ "386", amd64 ] | |
steps: | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: 1.22.4 | |
- uses: actions/checkout@v4 | |
- name: Install goversioninfo | |
run: | | |
go install github.com/josephspurrier/goversioninfo/cmd/[email protected] | |
- name: Generate versionfile | |
run: | | |
go generate | |
working-directory: cmd/joinme.click-launcher | |
- name: Build binary | |
run: | | |
GOOS=windows GOARCH=${{ matrix.goarch }} go build -ldflags="-X 'main.buildTime=${{ needs.meta.outputs.date }}' -X 'main.buildCommit=${{ github.sha }}' -X 'main.buildVersion=${{ github.ref_name }}'" | |
working-directory: cmd/joinme.click-launcher | |
- name: Create binary release archive | |
run: | | |
zip -j joinme.click-launcher-${{ github.ref_name }}-windows-${{ matrix.goarch }}.zip cmd/joinme.click-launcher/joinme.click-launcher.exe config.example.yaml config.recommended.yaml | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: launcher-${{ github.ref_name }}-windows-${{ matrix.goarch }} | |
path: joinme.click-launcher-${{ github.ref_name }}-windows-${{ matrix.goarch }}.zip | |
retention-days: 5 | |
if-no-files-found: error | |
build-installer: | |
name: Build InnoSetup installer | |
runs-on: windows-latest | |
needs: | |
- meta | |
- build-binary | |
strategy: | |
matrix: | |
goarch: [ "386", amd64 ] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: release-${{ github.ref_name }} | |
path: cmd/joinme.click-launcher | |
- name: Unpack binary release archive | |
run: | | |
Expand-Archive -LiteralPath joinme.click-launcher-${{ github.ref_name }}-windows-${{ matrix.goarch }}.zip -DestinationPath . | |
working-directory: cmd/joinme.click-launcher | |
- name: Build installer | |
run: | | |
&"${Env:ProgramFiles(x86)}\Inno Setup 6\iscc.exe" "setup.iss" /Fjoinme.click-launcher-${{ github.ref_name }}-windows-${{ matrix.goarch }}-setup | |
working-directory: cmd/joinme.click-launcher | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: setup-${{ github.ref_name }}-windows-${{ matrix.goarch }} | |
path: cmd/joinme.click-launcher/joinme.click-launcher-${{ github.ref_name }}-windows-${{ matrix.goarch }}-setup.exe | |
retention-days: 5 | |
if-no-files-found: error | |
create-release: | |
name: Create release | |
runs-on: ubuntu-latest | |
needs: | |
- meta | |
- build-binary | |
- build-installer | |
steps: | |
- uses: actions/download-artifact@v4 | |
- name: Create hash files | |
run: | | |
for file in $(find . -type f -name "joinme.click-launcher-${{ github.ref_name }}-*") | |
do | |
md5sum $file | cut -f 1 -d " " > $file.md5 | |
sha256sum $file | cut -f 1 -d " " > $file.sha256 | |
done | |
- name: List release files | |
run: | | |
ls -l | |
- uses: softprops/action-gh-release@v2 | |
with: | |
files: | | |
joinme.click-launcher-${{ github.ref_name }}-* | |
draft: true | |
generate_release_notes: true | |
name: joinme.click-launcher ${{ github.ref_name }} | |
body: This is the ${{ github.ref_name }} release of the joinme.click-launcher. |