-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
commit a5aef25 Author: Ankur Banerjee <ankurdotb@users.noreply.github.com> Date: Mon Aug 15 10:44:13 2022 +0100 build: Optimise Docker build (#365) commit 4517a19 Author: Andrew Nikitin <andrew.nikitin@cheqd.io> Date: Sat Aug 13 03:55:47 2022 +0300 ci: Add automated semantic release using Goreleaser (#357) Co-authored-by: Ankur Banerjee <ankurdotb@users.noreply.github.com> commit 5a30740 Author: Ankur Banerjee <ankurdotb@users.noreply.github.com> Date: Sat Aug 13 01:53:06 2022 +0100 ci: Disable cleanup dry-run commit 3e8aea4 Author: Ankur Banerjee <ankurdotb@users.noreply.github.com> Date: Sat Aug 13 01:42:43 2022 +0100 ci: Fix linting error commit c335aba Author: Ankur Banerjee <ankurdotb@users.noreply.github.com> Date: Sat Aug 13 01:38:00 2022 +0100 ci: Make workflow cleanup choices easier commit d89f496 Author: Ankur Banerjee <ankurdotb@users.noreply.github.com> Date: Sat Aug 13 01:29:14 2022 +0100 ci: Cleanup old workflow runs (#364)
- Loading branch information
Showing
16 changed files
with
10,565 additions
and
108 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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: "Cleanup" | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
days: | ||
description: 'Retain days' | ||
required: true | ||
type: string | ||
default: 30 | ||
minimum_runs: | ||
description: 'Minimum runs to keep for each workflow' | ||
required: true | ||
type: string | ||
default: 0 | ||
delete_workflow_pattern: | ||
description: 'Name/filename of workflow. Default is all.' | ||
required: false | ||
type: string | ||
delete_workflow_by_state_pattern: | ||
description: 'Remove workflow by state: active, deleted, disabled_fork, disabled_inactivity, disabled_manually' | ||
required: true | ||
default: All | ||
type: choice | ||
options: | ||
- All | ||
- active | ||
- deleted | ||
- disabled_inactivity | ||
- disabled_manually | ||
|
||
jobs: | ||
|
||
del-runs: | ||
name: "Delete old workflow runs" | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: Mattraks/delete-workflow-runs@v2 | ||
with: | ||
token: ${{ github.token }} | ||
repository: ${{ github.repository }} | ||
retain_days: ${{ github.event.inputs.days }} | ||
keep_minimum_runs: ${{ github.event.inputs.minimum_runs }} | ||
delete_workflow_pattern: ${{ github.event.inputs.delete_workflow_pattern }} | ||
delete_workflow_by_state_pattern: ${{ github.event.inputs.delete_workflow_by_state_pattern }} | ||
|
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 |
---|---|---|
@@ -1,86 +1,132 @@ | ||
name: "Release" | ||
on: | ||
workflow_call: | ||
inputs: | ||
RELEASE_VERSION: | ||
description: "Release version number" | ||
type: string | ||
defaults: | ||
run: | ||
shell: bash | ||
permissions: | ||
contents: write | ||
packages: write | ||
|
||
|
||
jobs: | ||
|
||
release-packages: | ||
name: "Release cheqd-noded binary" | ||
release-binary: | ||
name: "Node binary" | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
env: | ||
RELEASE_VERSION: ${{ inputs.RELEASE_VERSION }} | ||
outputs: | ||
RELEASE_VERSION: ${{ steps.set-version.outputs.RELEASE_VERSION }} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 # Required to fetch version | ||
persist-credentials: false | ||
|
||
- name: Download node binary from build stage | ||
uses: actions/download-artifact@v3 | ||
- uses: actions/setup-go@v3 | ||
with: | ||
name: cheqd-noded | ||
path: build-tools | ||
go-version-file: ./go.mod | ||
cache: true | ||
|
||
- name: Restore binary permissions | ||
run: sudo chmod +x build-tools/cheqd-noded | ||
# 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' | ||
|
||
# Setup for pushing to Buf.build later | ||
- uses: bufbuild/buf-setup-action@v1.7.0 | ||
|
||
# Required for short-lived token provided to Semantic Release | ||
- name: "Obtain Github App token" | ||
id: app-token | ||
uses: getsentry/action-github-app-token@v1.0.6 | ||
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 release version number | ||
id: set-version | ||
run: | | ||
RELEASE_VERSION=$( git describe --tags ${{ github.sha }}) | ||
echo ::set-output name=RELEASE_VERSION::"$RELEASE_VERSION" | ||
- uses: "marvinpinto/action-automatic-releases@latest" | ||
# Push Protobufs to Buf.build registry | ||
- uses: bufbuild/buf-push-action@v1 | ||
with: | ||
repo_token: "${{ secrets.GITHUB_TOKEN }}" | ||
automatic_release_tag: "${{ env.GITHUB_REF_NAME }}" | ||
prerelease: true | ||
draft: true | ||
files: | | ||
build-tools/cheqd-noded | ||
release-docker-images: | ||
name: "Publish Docker images for new version" | ||
input: proto | ||
buf_token: ${{ secrets.BUF_TOKEN }} | ||
|
||
release-docker: | ||
name: "Docker image" | ||
needs: release-binary | ||
runs-on: ubuntu-latest | ||
env: | ||
REGISTRY: ghcr.io | ||
RELEASE_VERSION: ${{ inputs.RELEASE_VERSION }} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 # Required to fetch version | ||
persist-credentials: false | ||
|
||
- name: Generate golang code | ||
run: make proto-gen | ||
|
||
- name: Build cheqd-cli Docker image 'cheqd-noded' as entrypoint and no build args | ||
run: docker build --target base -t cheqd-cli -f docker/Dockerfile . | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version-file: ./go.mod | ||
cache: true | ||
|
||
- name: Build cheqd-node Docker image with 'node-start' as entrypoint and no build args | ||
run: docker build --target node -t cheqd-node -f docker/Dockerfile . | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
id: buildx | ||
with: | ||
version: latest | ||
|
||
- name: Login to Container registry | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
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/${{ github.repository}} | ||
flavor: | | ||
latest=auto | ||
tags: | | ||
type=semver,pattern={{version}},value=${{ needs.release-binary.outputs.RELEASE_VERSION }} | ||
labels: | | ||
org.opencontainers.image.title="cheqd Node Docker Image" | ||
org.opencontainers.image.description="Node for cheqd network" | ||
org.opencontainers.image.source="https://github.com/cheqd/cheqd-node" | ||
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" | ||
- name: Push cheqd-node image | ||
run: | | ||
docker tag cheqd-node ghcr.io/${{ github.repository }}:${{ env.RELEASE_VERSION }} | ||
docker tag cheqd-node ghcr.io/${{ github.repository }}:latest | ||
docker push ghcr.io/${{ github.repository }}:${{ env.RELEASE_VERSION }} | ||
docker push ghcr.io/${{ github.repository }}:latest | ||
- name: Push cheqd-cli image | ||
run: | | ||
docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.RELEASE_VERSION }} | ||
docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest | ||
docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.RELEASE_VERSION }} | ||
docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest | ||
- 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 }} |
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,4 +1,6 @@ | ||
### APP-SPECIFIC EXCLUSIONS ### | ||
build/ | ||
dist/ | ||
|
||
# Tests | ||
**/network-config | ||
|
Oops, something went wrong.