Update build pipelines to support RC builds
This commit is contained in:
42
.github/workflows/build.yml
vendored
42
.github/workflows/build.yml
vendored
@@ -19,6 +19,14 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
go-version: '1.21'
|
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
|
- name: Check out code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
@@ -31,7 +39,6 @@ jobs:
|
|||||||
|
|
||||||
- name: Cross-compile with xgo
|
- name: Cross-compile with xgo
|
||||||
uses: crazy-max/ghaction-xgo@v3
|
uses: crazy-max/ghaction-xgo@v3
|
||||||
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
|
|
||||||
with:
|
with:
|
||||||
xgo_version: latest
|
xgo_version: latest
|
||||||
go_version: 1.21
|
go_version: 1.21
|
||||||
@@ -50,26 +57,6 @@ jobs:
|
|||||||
buildmode: default
|
buildmode: default
|
||||||
trimpath: true
|
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
|
- name: Compress artifacts
|
||||||
run: |
|
run: |
|
||||||
mkdir -p compressed_artifacts
|
mkdir -p compressed_artifacts
|
||||||
@@ -112,20 +99,25 @@ jobs:
|
|||||||
name: compiled-binaries
|
name: compiled-binaries
|
||||||
path: compressed_artifacts
|
path: compressed_artifacts
|
||||||
|
|
||||||
- name: Publish to zurg-testing
|
- name: Publish to zurg or zurg-testing
|
||||||
run: |
|
run: |
|
||||||
git config --global user.name "Zurg"
|
git config --global user.name "Zurg"
|
||||||
git config --global user.email "zurg@debridmediamanager.com"
|
git config --global user.email "zurg@debridmediamanager.com"
|
||||||
git lfs install
|
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
|
- name: Create Release in Target Repository
|
||||||
uses: actions/github-script@v7
|
uses: actions/github-script@v7
|
||||||
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
|
|
||||||
with:
|
with:
|
||||||
github-token: ${{ secrets.TOKEN }}
|
github-token: ${{ secrets.TOKEN }}
|
||||||
script: |
|
script: |
|
||||||
const ownerName = 'debridmediamanager';
|
const ownerName = 'debridmediamanager';
|
||||||
const repoName = 'zurg-testing';
|
const repoName = '${{ github.ref.includes("-rc.") ? "zurg" : "zurg-testing" }}';
|
||||||
const tagName = '${{ steps.version.outputs.version }}';
|
const tagName = '${{ steps.version.outputs.version }}';
|
||||||
const releaseName = `${tagName}`;
|
const releaseName = `${tagName}`;
|
||||||
|
|
||||||
@@ -159,7 +151,7 @@ jobs:
|
|||||||
|
|
||||||
${sponsorshipDetails}
|
${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({
|
const response = await github.rest.repos.createRelease({
|
||||||
|
|||||||
32
.github/workflows/build_docker.yml
vendored
32
.github/workflows/build_docker.yml
vendored
@@ -35,6 +35,8 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
path: /tmp/.buildx-cache
|
path: /tmp/.buildx-cache
|
||||||
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-buildx-
|
||||||
|
|
||||||
- name: Log in to GitHub Container Registry
|
- name: Log in to GitHub Container Registry
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
@@ -43,16 +45,14 @@ jobs:
|
|||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
# private image
|
|
||||||
- name: Extract metadata (tags, labels) for Docker
|
- name: Extract metadata (tags, labels) for Docker
|
||||||
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
|
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
with:
|
with:
|
||||||
images: ghcr.io/${{ github.repository }}
|
images: |
|
||||||
|
ghcr.io/${{ github.repository }}${{ github.ref.contains('-rc.') ? '' : '-testing' }}
|
||||||
|
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
|
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
@@ -66,27 +66,3 @@ jobs:
|
|||||||
BuiltAt=${{ steps.buildvars.outputs.built_at }}
|
BuiltAt=${{ steps.buildvars.outputs.built_at }}
|
||||||
GitCommit=${{ steps.buildvars.outputs.git_commit }}
|
GitCommit=${{ steps.buildvars.outputs.git_commit }}
|
||||||
Version=${{ steps.buildvars.outputs.version }}
|
Version=${{ steps.buildvars.outputs.version }}
|
||||||
|
|
||||||
# public image
|
|
||||||
- name: Extract metadata (tags, labels) for Docker
|
|
||||||
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
|
|
||||||
id: publicmeta
|
|
||||||
uses: docker/metadata-action@v5
|
|
||||||
with:
|
|
||||||
images: ghcr.io/${{ github.repository }}-testing
|
|
||||||
|
|
||||||
- name: Build and push Docker image
|
|
||||||
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
|
||||||
push: true
|
|
||||||
tags: ${{ steps.publicmeta.outputs.tags }}
|
|
||||||
labels: ${{ steps.publicmeta.outputs.labels }}
|
|
||||||
cache-from: type=local,src=/tmp/.buildx-cache
|
|
||||||
cache-to: type=local,dest=/tmp/.buildx-cache
|
|
||||||
build-args: |
|
|
||||||
BuiltAt=${{ steps.buildvars.outputs.built_at }}
|
|
||||||
GitCommit=${{ steps.buildvars.outputs.git_commit }}
|
|
||||||
Version=${{ steps.buildvars.outputs.version }}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user