Update ci.yml #3
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
name: CI | |
on: | |
push: | |
branches: | |
- master | |
release: | |
types: [created] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
arch: [amd64, arm64] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: '1.22' | |
- name: Build binary | |
run: | | |
GOARCH=${{ matrix.arch }} | |
GOOS=linux go build -o bbx-${GOARCH} | |
- name: Upload binaries | |
uses: actions/upload-artifact@v4 | |
with: | |
name: bbx-${{ matrix.arch }} | |
path: bbx-${{ matrix.arch }} | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and push Docker image | |
run: | | |
docker buildx build --build-arg IMAGE=golang:1.22 --platform linux/amd64,linux/arm64 -t snail2sky/bbx:latest . --push | |
- name: Create GitHub Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag: ${{ github.ref }} | |
files: | | |
bbx-amd64 | |
bbx-arm64 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |