forked from cheqd/cheqd-node
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: [DDS-514] Added Release GitHub workflow (#24)
- Added `Release` GitHub workflow. - Made `call-build` job dependent on `call-lint` job. - Disabled caching in `actions/setup-go` before `golangci/golangci-lint-action` to avoid golangci/golangci-lint-action#23. - Made some minor corrections.
- Loading branch information
Showing
6 changed files
with
170 additions
and
59 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,30 @@ | ||
name: "Workflow Dispatch" | ||
on: push | ||
concurrency: | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
|
||
jobs: | ||
|
||
call-lint: | ||
name: "Lint" | ||
uses: ./.github/workflows/lint.yml | ||
secrets: inherit | ||
|
||
call-build: | ||
name: "Build" | ||
needs: call-lint | ||
uses: ./.github/workflows/build.yml | ||
secrets: inherit | ||
|
||
call-test: | ||
name: "Tests" | ||
needs: [ call-lint, call-build ] | ||
needs: call-build | ||
uses: ./.github/workflows/test.yml | ||
secrets: inherit | ||
|
||
call-release: | ||
name: "Release" | ||
needs: call-test | ||
if: ${{ github.ref_type == 'tag' }} | ||
uses: ./.github/workflows/release.yml | ||
secrets: inherit |
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 |
---|---|---|
@@ -0,0 +1,108 @@ | ||
name: "Release" | ||
on: | ||
workflow_call: | ||
defaults: | ||
run: | ||
shell: bash | ||
|
||
env: | ||
BIN_NAME: cheqd-noded | ||
|
||
jobs: | ||
release-binary: | ||
name: "Node binary" | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
outputs: | ||
RELEASE_VERSION: ${{ steps.set-version.outputs.RELEASE_VERSION }} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 # to fetch all history | ||
|
||
- name: Set release version number | ||
id: set-version | ||
run: | | ||
RELEASE_VERSION=$( git describe --tags "${{ github.sha }}") | ||
echo "RELEASE_VERSION=$RELEASE_VERSION" >> "$GITHUB_OUTPUT" | ||
- name: Download binary artifact | ||
uses: actions/download-artifact@v3 | ||
id: download | ||
with: | ||
path: release/ | ||
|
||
- name: Display structure of downloaded files | ||
run: ls -R | ||
working-directory: release | ||
|
||
- name: Archive application binary | ||
run: | | ||
tar czf release/cheqd-node-${{ steps.set-version.outputs.RELEASE_VERSION }}-linux.tar.gz LICENSE README.md -C release/${{ env.BIN_NAME }}-linux ${{ env.BIN_NAME }} | ||
shell: bash | ||
|
||
- name: Publish the Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
prerelease: true | ||
tag_name: ${{ steps.set-version.outputs.RELEASE_VERSION }} | ||
target_commitish: ${{ github.sha }} | ||
files: release/* | ||
generate_release_notes: true | ||
|
||
release-docker: | ||
name: "Docker image" | ||
needs: release-binary | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
env: | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
id: buildx | ||
with: | ||
version: latest | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Configure Docker image metadata | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: | | ||
ghcr.io/${{ env.IMAGE_NAME }} | ||
flavor: | | ||
latest=auto | ||
tags: | | ||
type=semver,pattern={{version}},value=${{ needs.release-binary.outputs.RELEASE_VERSION }} | ||
type=raw,value=production-latest | ||
type=sha,format=long | ||
labels: | | ||
org.opencontainers.image.vendor="Canow" | ||
org.opencontainers.image.created={{date 'dddd, MMMM Do YYYY, h:mm:ss a'}} | ||
# org.opencontainers.image.documentation="" | ||
|
||
- name: Build and push image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
file: docker/Dockerfile | ||
platforms: linux/amd64 | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=min |
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