Skip to content

Commit

Permalink
ci: generate binaries
Browse files Browse the repository at this point in the history
Signed-off-by: Ignacio Hagopian <[email protected]>
  • Loading branch information
jsign committed Dec 13, 2022
1 parent aee2118 commit b720a45
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 1 deletion.
61 changes: 61 additions & 0 deletions .github/workflows/binaries.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Generate binaries
on:
release:
types:
- created
jobs:
binaries:
strategy:
matrix:
include:
- os: ubuntu-latest
asset_name: api-linux-amd64.tar.gz
compress_cmd: tar -czvf
build_cmd: docker run -v $PWD:/data golang:1.19 bash -c "cd /data && go build ./cmd/api"
- os: windows-latest
asset_name: api-windows-amd64.zip
compress_cmd: tar.exe -a -c -f
build_cmd: go build -o api ./cmd/api
- os: macos-latest
asset_name: api-darwin-amd64.tar.gz
compress_cmd: tar -czvf
build_cmd: go build -o api ./cmd/api
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: v1.19.x
- name: Build binary
run: ${{ matrix.build_cmd }}
- name: Pack output
run: ${{ matrix.compress_cmd }} ${{ matrix.asset_name }} api
- name: Upload binary
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ matrix.asset_name }}
asset_name: ${{ matrix.asset_name }}
tag: ${{ github.ref_name }}
overwrite: true
docker:
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v3
with:
file: ./cmd/api/Dockerfile
push: true
tags: textile/tableland:latest,textile/tableland:${{ github.ref_name }}
platforms: linux/amd64, linux/arm64
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:

jobs:
deploy:
if: github.event_name == 'release' || github.ref == 'refs/heads/main' || contains(github.event.head_commit.message, '[stagingdeploy]') || contains(github.event.head_commit.message, '[testnetdeploy]') || contains(github.event.head_commit.message, '[mainnetdeploy]')
if: contains(github.event.head_commit.message, '[stagingdeploy]') || contains(github.event.head_commit.message, '[testnetdeploy]') || contains(github.event.head_commit.message, '[mainnetdeploy]')
name: Deploy
runs-on: ubuntu-latest
steps:
Expand Down

0 comments on commit b720a45

Please sign in to comment.