add some margin for gas fees #38
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
# Simple workflow for bumping version when pushing to main | |
name: Bump patch version | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
concurrency: | |
group: "version" | |
cancel-in-progress: true | |
jobs: | |
patch: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go 1.x | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ^1.22 | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- uses: actions-ecosystem/action-get-latest-tag@v1 | |
id: get-latest-tag | |
with: | |
initial_version: "0.0.0" | |
- uses: actions-ecosystem/action-bump-semver@v1 | |
id: bump-semver | |
with: | |
current_version: ${{ steps.get-latest-tag.outputs.tag }} | |
level: patch | |
- uses: actions-ecosystem/action-push-tag@v1 | |
with: | |
tag: ${{ steps.bump-semver.outputs.new_version }} | |
message: "[tagged] ${{ steps.bump-semver.outputs.new_version }}" | |
- name: Download dependencies | |
run: go mod download | |
- name: Build for Linux amd64 | |
env: | |
GOOS: linux | |
GOARCH: amd64 | |
CGO_ENABLED: 1 | |
run: | | |
go build -v -o 'outputs/indexer_linux_amd64_${{ steps.bump-semver.outputs.new_version }}' cmd/node/main.go | |
go build -v -o 'outputs/pgmigrator_linux_amd64_${{ steps.bump-semver.outputs.new_version }}' cmd/migrator/main.go | |
- name: Make binaries executable | |
run: | | |
chmod +x 'outputs/indexer_linux_amd64_${{ steps.bump-semver.outputs.new_version }}' | |
chmod +x 'outputs/pgmigrator_linux_amd64_${{ steps.bump-semver.outputs.new_version }}' | |
- name: Install ARM compilation dependencies | |
run: sudo apt-get install -y gcc-aarch64-linux-gnu | |
- name: Build for Linux arm64 | |
env: | |
CC: aarch64-linux-gnu-gcc | |
CXX: aarch64-linux-gnu-g++ | |
GOOS: linux | |
GOARCH: arm64 | |
CGO_ENABLED: 1 | |
run: | | |
go build -v -o 'outputs/indexer_linux_arm64_${{ steps.bump-semver.outputs.new_version }}' cmd/node/main.go | |
go build -v -o 'outputs/pgmigrator_linux_arm64_${{ steps.bump-semver.outputs.new_version }}' cmd/migrator/main.go | |
- name: Make binaries executable | |
run: | | |
chmod +x 'outputs/indexer_linux_arm64_${{ steps.bump-semver.outputs.new_version }}' | |
chmod +x 'outputs/pgmigrator_linux_arm64_${{ steps.bump-semver.outputs.new_version }}' | |
- name: Create version file | |
run: echo '${{ steps.bump-semver.outputs.new_version }}' > outputs/version | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v3 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: eu-west-1 | |
- name: Upload outputs to S3 | |
run: aws s3 sync ./outputs s3://cw-build-artifacts/indexer | |
- name: Invalidate Build Outputs CloudFront cache | |
run: aws cloudfront create-invalidation --distribution-id EKM5NR0TASZ5T --paths '/*' | |
- name: Notify of successful web deploy | |
run: | | |
curl --location '${{ secrets.DISCORD_WEBHOOK_URL }}' \ | |
--header 'Content-Type: application/json' \ | |
--data '{ | |
"content": "new binaries available: ${{ steps.bump-semver.outputs.new_version }}\n\n download for arm64: \n `curl -L https://builds.internal.citizenwallet.xyz/indexer/indexer_linux_arm64_${{ steps.bump-semver.outputs.new_version }} -o indexer && chmod +x indexer`\n\n download for amd64: \n `curl -L https://builds.internal.citizenwallet.xyz/indexer/indexer_linux_amd64_${{ steps.bump-semver.outputs.new_version }} -o indexer && chmod +x indexer`" | |
}' |