diff --git a/.github/workflows/binaries.yml b/.github/workflows/binaries.yml new file mode 100644 index 00000000..27370ab2 --- /dev/null +++ b/.github/workflows/binaries.yml @@ -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 diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 7df6c4bd..2f76533d 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -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: