Skip to content

CI

CI #31

Workflow file for this run

name: CI
on:
push:
tags:
- 'v*.*.*'
release:
types: [created]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
arch: [amd64, arm64]
os: [linux, darwin, windows]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set variables
id: variables
run: |
tag=`basename ${{ github.ref }}`
# golang_version=1.22
# cgo_enabled=0
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.22
- name: Build binary
run: |
export GOOS=${{ matrix.os }}
export GOARCH=${{ matrix.arch }}
export CGO_ENABLE=0
go build -o bbx-${GOOS}-${GOARCH}
- name: run
run: |
ls -al
tree
- name: Upload binaries
uses: actions/upload-artifact@v4
with:
name: bbx-${{ matrix.os }}-${{ matrix.arch }}
path: bbx-${{ matrix.os }}-${{ matrix.arch }}
- name: Release
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ steps.variables.outputs.tag }}
files: |
bbx-${{ matrix.os }}-${{ matrix.arch }}
- name: run
run: |
ls -al; tree
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: run
run: |
ls -al
tree
- 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
docker buildx build --build-arg IMAGE=golang:1.22 --platform linux/amd64 -t snail2sky/bbx:${{ steps.variables.outputs.tag }} . --push