forked from Lorenzo-Protocol/lorenzo
-
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.
Merge pull request #1 from sheldonleedev/sheldon/chore-workflow
chore(ci): add build binary and build-and-push docker image github w…
- Loading branch information
Showing
2 changed files
with
95 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
name: Release Binary | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
permissions: write-all | ||
|
||
# This workflow creates a release using goreleaser | ||
# via the 'make release' command. | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
environment: release | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: "1.20" | ||
check-latest: true | ||
|
||
- name: Setup release environment | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: |- | ||
echo 'GITHUB_TOKEN=${{secrets.GITHUB_TOKEN}}' > .release-env | ||
- name: Release publish | ||
run: make release |
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,60 @@ | ||
# This workflow pushes new lorenzo images on every new tag. | ||
# | ||
# On every new `vX.Y.Z` tag the following images are pushed: | ||
# | ||
# lorenzoprotocol/lorenzo:X.Y.Z # is pushed | ||
# lorenzoprotocol/lorenzo:X.Y # is updated to X.Y.Z | ||
# lorenzoprotocol/lorenzo:X # is updated to X.Y.Z | ||
# lorenzoprotocol/lorenzo:latest # is updated to X.Y.Z | ||
|
||
name: Build and Publish Docker Image | ||
on: | ||
release: | ||
types: [published, created, edited] | ||
push: | ||
tags: | ||
- "v[0-9]+.[0-9]+.[0-9]+" # Push events to matching v*, i.e. v1.0, v20.15.10 | ||
- "v[0-9]+.[0-9]+.[0-9]+-rc*" # Push events to matching v*, i.e. v1.0-rc1, v20.15.10-rc5 # ignore rc | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
jobs: | ||
build-and-push: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v3 | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
- name: Parse tag | ||
id: tag | ||
run: | | ||
VERSION=$(echo ${{ github.ref_name }} | sed "s/v//") | ||
MAJOR_VERSION=$(echo $VERSION | cut -d '.' -f 1) | ||
MINOR_VERSION=$(echo $VERSION | cut -d '.' -f 2) | ||
PATCH_VERSION=$(echo $VERSION | cut -d '.' -f 3) | ||
echo "VERSION=$VERSION" >> $GITHUB_ENV | ||
echo "MAJOR_VERSION=$MAJOR_VERSION" >> $GITHUB_ENV | ||
echo "MINOR_VERSION=$MINOR_VERSION" >> $GITHUB_ENV | ||
echo "PATCH_VERSION=$PATCH_VERSION" >> $GITHUB_ENV | ||
- name: Build and push | ||
id: build_push_image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
file: Dockerfile | ||
context: . | ||
push: true | ||
platforms: linux/amd64, linux/arm64 | ||
tags: | | ||
lorenzoprotocol/dymension:${{ env.MAJOR_VERSION }} | ||
lorenzoprotocol/dymension:${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }} | ||
lorenzoprotocol/dymension:${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }}.${{ env.PATCH_VERSION }} |