Skip to content

Commit

Permalink
ci: Split the building from the upload of the artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
ret2libc committed Oct 20, 2023
1 parent 5ed0038 commit e40a0e8
Showing 1 changed file with 28 additions and 41 deletions.
69 changes: 28 additions & 41 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,9 @@ on:
tags:
- v[0-9].[0-9]+.[0-9]+
jobs:
create_release:
name: create_release
runs-on: ubuntu-22.04
if: startsWith(github.ref, 'refs/tags/')
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- uses: actions/checkout@v2
- name: Check version matches
run: |
[[ "$(grep app.Version main.go | sed -r 's/.*\"(v[0-9\.]+)\"/\1/')" =~ "${{ github.ref_name }}" ]]
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: true
prerelease: false

build:
name: build-rz-pm
runs-on: ubuntu-22.04
needs: create_release
strategy:
matrix:
goos: [windows, darwin, freebsd, openbsd, netbsd, linux, android]
Expand Down Expand Up @@ -81,23 +58,33 @@ jobs:
GOARM: ${{ matrix.goarm }}
CGO_ENABLED: ${{ matrix.cgo_enabled }}
CC: ${{ matrix.cc }}
- name: Upload artifact
if: matrix.goos != 'windows' && startsWith(github.ref, 'refs/tags/')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Rename rz-pm
run: mv ./rz-pm ./rz-pm-${{ matrix.goos }}-${{ matrix.asset_arch }}
- name: Upload rz-pm build
uses: actions/upload-artifact@v3
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ./rz-pm
asset_name: rz-pm-${{ matrix.goos }}-${{ matrix.asset_arch }}
asset_content_type: application/octet-stream
- name: Upload artifact (windows)
if: matrix.goos == 'windows' && startsWith(github.ref, 'refs/tags/')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
name: rz-pm-${{ matrix.goos }}-${{ matrix.asset_arch }}
path: ./rz-pm-${{ matrix.goos }}-${{ matrix.asset_arch }}

create_release:
name: create_release
runs-on: ubuntu-22.04
if: startsWith(github.ref, 'refs/tags/')
needs: [build]
steps:
- uses: actions/checkout@v2
- name: Check version matches
run: |
[[ "$(grep app.Version main.go | sed -r 's/.*\"(v[0-9\.]+)\"/\1/')" =~ "${{ github.ref_name }}" ]]
- uses: actions/download-artifact@v3
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ./rz-pm.exe
asset_name: rz-pm-${{ matrix.goos }}-${{ matrix.asset_arch }}.exe
asset_content_type: application/octet-stream
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ github.ref }}
name: Release ${{ github.ref }}
draft: true
prerelease: false
files: |
./rz-pm-*/*

0 comments on commit e40a0e8

Please sign in to comment.