forked from forbole/callisto
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: Automated semantic release with Goreleaser [DEV-1718] (#26)
* Create .releaserc.json * Move golang CI linter config * Update .goreleaser.yml * Versioned Docker image numbers * Fix Golang CI version * Disable Markdown linting * Temporarily disable YAML linter * Fix indentation
- Loading branch information
Showing
5 changed files
with
146 additions
and
44 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,22 +4,81 @@ on: | |
defaults: | ||
run: | ||
shell: bash | ||
permissions: | ||
contents: write | ||
packages: write | ||
|
||
|
||
jobs: | ||
|
||
release-binary: | ||
name: "Binary" | ||
runs-on: ubuntu-latest | ||
outputs: | ||
VERSION: ${{ steps.set-version.outputs.VERSION }} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version-file: ./go.mod | ||
|
||
# Node.js setup is needed to run Semantic Release | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
cache: 'npm' | ||
cache-dependency-path: '**/package-lock.json' | ||
|
||
- name: "Obtain Github App token" | ||
id: app-token | ||
uses: getsentry/[email protected] | ||
with: | ||
app_id: ${{ secrets.BOT_APP_ID }} | ||
private_key: ${{ secrets.BOT_APP_PRIVATE_KEY }} | ||
|
||
- name: "Install Semantic Release dependencies" | ||
run: npm ci | ||
|
||
- name: "Execute Semantic Release" | ||
run: npx semantic-release | ||
env: | ||
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | ||
|
||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v3 | ||
with: | ||
distribution: goreleaser | ||
version: latest | ||
args: release --rm-dist | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Set version number | ||
id: set-version | ||
run: | | ||
VERSION=$( git describe --tags ${{ github.sha }}) | ||
echo ::set-output name=VERSION::"$VERSION" | ||
release-bdjuno: | ||
name: "BDJuno Docker Image" | ||
runs-on: ubuntu-latest | ||
needs: release-binary | ||
env: | ||
IMAGE_NAME: ${{ github.repository }} | ||
COMMIT_SHA: ${{ github.sha }} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version-file: ./go.mod | ||
|
||
- name: Set network name | ||
id: set-network | ||
run: | | ||
|
@@ -46,9 +105,15 @@ jobs: | |
uses: docker/metadata-action@v4 | ||
with: | ||
images: registry.digitalocean.com/${{ env.IMAGE_NAME }} | ||
flavor: | | ||
latest=auto | ||
tags: | | ||
${{ steps.set-network.outputs.NETWORK_NAME }}-latest | ||
type=semver,pattern={{version}},value=${{ needs.release-binary.outputs.VERSION }} | ||
labels: | | ||
org.opencontainers.image.title="BDJuno for cheqd network" | ||
org.opencontainers.image.description="BDJuno for cheqd network" | ||
org.opencontainers.image.source="https://github.com/cheqd/bdjuno" | ||
org.opencontainers.image.vendor="Cheqd Foundation Limited" | ||
org.opencontainers.image.created={{date 'dddd, MMMM Do YYYY, h:mm:ss a'}} | ||
org.opencontainers.image.documentation="https://docs.cheqd.io/node" | ||
|
@@ -66,6 +131,7 @@ jobs: | |
- name: Push BDJuno image | ||
run: | | ||
docker push registry.digitalocean.com/${{ env.IMAGE_NAME }}:${{ steps.set-network.outputs.NETWORK_NAME }}-latest | ||
docker push registry.digitalocean.com/${{ env.IMAGE_NAME }}:${{ needs.release-binary.outputs.VERSION }} | ||
release-hasuracli: | ||
name: "Hasura CLI Docker Image" | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
"branches": [ | ||
"chains/cheqd/mainnet", | ||
{ | ||
"name": "chains/cheqd/testnet", | ||
"channel": "beta", | ||
"prerelease": true | ||
} | ||
], | ||
"tagFormat": "${version}", | ||
"ci": true, | ||
"preset": "conventionalcommits", | ||
"plugins": [ | ||
[ "@semantic-release/commit-analyzer", | ||
{ | ||
"parserOpts": "./.github/linters/.commitlint.rules.js", | ||
"releaseRules": [ | ||
{ "breaking": true, "release": "major" }, | ||
{ "type": "feat", "release": "minor" }, | ||
{ "type": "fix", "release": "patch" }, | ||
{ "type": "perf", "release": "patch" }, | ||
{ "type": "build", "release": "patch" }, | ||
{ "scope": "security", "release": "patch" }, | ||
{ "type": "chore", "release": false }, | ||
{ "type": "ci", "release": false }, | ||
{ "type": "docs", "release": false }, | ||
{ "type": "refactor", "release": false }, | ||
{ "type": "revert", "release": false }, | ||
{ "type": "style", "release": false }, | ||
{ "type": "test", "release": false }, | ||
{ "scope": "no-release", "release": false }, | ||
{ "scope": "release", "release": "patch" } | ||
], | ||
"presetConfig": true | ||
} | ||
], | ||
[ "@semantic-release/git", | ||
{ | ||
"assets": [ "package.json" ], | ||
"message": "chore(release): ${nextRelease.version} [skip ci]" | ||
} | ||
] | ||
] | ||
} |