Update build pipelines to support RC builds

This commit is contained in:
Ben Sarmiento
2024-05-28 10:00:21 +02:00
parent d8b0bfc9f4
commit baf33c9e28
2 changed files with 21 additions and 53 deletions

View File

@@ -19,6 +19,14 @@ jobs:
with:
go-version: '1.21'
- name: Cache Go Modules
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
- name: Check out code
uses: actions/checkout@v4
@@ -31,7 +39,6 @@ jobs:
- name: Cross-compile with xgo
uses: crazy-max/ghaction-xgo@v3
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
with:
xgo_version: latest
go_version: 1.21
@@ -50,26 +57,6 @@ jobs:
buildmode: default
trimpath: true
- name: Cross-compile with xgo
uses: crazy-max/ghaction-xgo@v3
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
with:
xgo_version: latest
go_version: 1.21
pkg: cmd/zurg
dest: artifacts
prefix: zurg
v: false
x: false
race: false
ldflags: >
-s -w
-X 'github.com/debridmediamanager/zurg/internal/version.BuiltAt=${{ steps.prep.outputs.built_at }}'
-X 'github.com/debridmediamanager/zurg/internal/version.GitCommit=${{ steps.prep.outputs.git_commit }}'
-X 'github.com/debridmediamanager/zurg/internal/version.Version=${{ steps.prep.outputs.version }}'
buildmode: default
trimpath: true
- name: Compress artifacts
run: |
mkdir -p compressed_artifacts
@@ -112,20 +99,25 @@ jobs:
name: compiled-binaries
path: compressed_artifacts
- name: Publish to zurg-testing
- name: Publish to zurg or zurg-testing
run: |
git config --global user.name "Zurg"
git config --global user.email "zurg@debridmediamanager.com"
git lfs install
if [[ "${{ steps.version.outputs.version }}" == *"-rc."* ]]; then
git remote set-url origin git@github.com:debridmediamanager/zurg.git
else
git remote set-url origin git@github.com:debridmediamanager/zurg-testing.git
fi
- name: Create Release in Target Repository
uses: actions/github-script@v7
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
with:
github-token: ${{ secrets.TOKEN }}
script: |
const ownerName = 'debridmediamanager';
const repoName = 'zurg-testing';
const repoName = '${{ github.ref.includes("-rc.") ? "zurg" : "zurg-testing" }}';
const tagName = '${{ steps.version.outputs.version }}';
const releaseName = `${tagName}`;
@@ -159,7 +151,7 @@ jobs:
${sponsorshipDetails}
[version history](https://github.com/debridmediamanager/zurg-testing/wiki/History)
[version history](https://github.com/debridmediamanager/${repoName}/wiki/History)
`;
const response = await github.rest.repos.createRelease({