Skip to content

Commit d867b4c

Browse files
authored
Chore: Updated CI workflows to trigger releases based on branches (#1565)
* Updated goreleaser condition for main and beta branches * Chore: Updated CI for main branch and Added CI for Beta * wf update
1 parent d651919 commit d867b4c

4 files changed

Lines changed: 48 additions & 4 deletions

File tree

.github/workflows/main.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Main Workflow
33
on:
44
pull_request: {}
55
push:
6-
branches: [ "main" ]
6+
branches: [ "main", "beta" ]
77

88

99
concurrency:
@@ -65,7 +65,9 @@ jobs:
6565
needs: unit-tests
6666

6767
# Skip running if the PR is coming from a fork or is created by dependabot or snyk due to missing repo secrets.
68-
if: github.event.pull_request.head.repo.fork == false && (github.actor != 'dependabot[bot]' && github.actor != 'snyk-bot')
68+
# Only run on pushes to main or PRs targeting main.
69+
if: github.event.pull_request.head.repo.fork == false && (github.actor != 'dependabot[bot]' && github.actor != 'snyk-bot') &&
70+
(github.ref == 'refs/heads/main' || github.base_ref == 'main')
6971

7072
steps:
7173
- name: Check out the code

.github/workflows/release-beta.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Release Beta
2+
3+
on:
4+
push:
5+
tags:
6+
# Prerelease tags only, e.g. v1.2.3-beta.1. Stable releases such as
7+
# v1.2.3 are handled by release.yml.
8+
- "v[0-9]+.[0-9]+.[0-9]+-*"
9+
10+
permissions:
11+
contents: write
12+
13+
jobs:
14+
goreleaser:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
19+
with:
20+
fetch-depth: 0 # This ensures all history and tags are fetched
21+
path: auth0-cli
22+
23+
- name: Set up Go
24+
uses: actions/setup-go@be3c94b385c4f180051c996d336f57a34c397495 # v3.6.1
25+
with:
26+
go-version-file: auth0-cli/go.mod
27+
check-latest: true
28+
29+
# GoReleaser automatically marks SemVer prerelease tags (those with a
30+
# "-suffix") as GitHub prereleases. Homebrew and Scoop PRs are
31+
# intentionally omitted so beta builds never reach package managers.
32+
- name: Run GoReleaser
33+
uses: goreleaser/goreleaser-action@90a3faa9d0182683851fbfa97ca1a2cb983bfca3 # pin@6.2.1
34+
with:
35+
version: "2.7.0"
36+
args: release --clean
37+
workdir: 'auth0-cli'
38+
env:
39+
GITHUB_TOKEN: ${{ github.token }}

.github/workflows/release.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ name: Release
33
on:
44
push:
55
tags:
6-
- "v*"
6+
# Stable releases only, e.g. v1.2.3. Prerelease tags such as
7+
# v1.2.3-beta.1 are handled by release-beta.yml.
8+
- "v[0-9]+.[0-9]+.[0-9]+"
9+
710

811
permissions:
912
contents: write

.github/workflows/security.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Security
33
on:
44
pull_request: {}
55
push:
6-
branches: [ "main" ]
6+
branches: [ "main", "beta" ]
77
schedule:
88
- cron: "30 0 1,15 * *"
99

0 commit comments

Comments
 (0)