Skip to content

Commit

Permalink
Create ci.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
snail2sky authored Oct 24, 2024
1 parent 3e309cd commit d95b73c
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: CI

on:
push:
branches:
- main
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@v2
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 --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 }}

0 comments on commit d95b73c

Please sign in to comment.