memories/.github/workflows/release.yml

69 lines
1.7 KiB
YAML
Raw Normal View History

2023-11-01 07:15:28 +00:00
name: release
2022-11-11 04:26:21 +00:00
on:
push:
tags:
2023-02-24 08:29:50 +00:00
- "*"
2022-11-11 04:26:21 +00:00
jobs:
2023-11-01 07:15:28 +00:00
build:
name: Build
2022-11-11 04:26:21 +00:00
runs-on: ubuntu-latest
container:
2023-02-24 08:29:50 +00:00
image: golang:1.20-bullseye
2022-11-11 04:26:21 +00:00
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build
2023-11-01 07:15:28 +00:00
run: |
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -buildvcs=false -ldflags="-s -w" -o go-vod-amd64
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -buildvcs=false -ldflags="-s -w" -o go-vod-arm64
2022-11-11 04:26:21 +00:00
- name: Upload to releases
uses: svenstaro/upload-release-action@v2
id: attach_to_release
with:
2023-11-01 07:15:28 +00:00
file: go-vod-*
file_glob: true
2022-11-11 04:26:21 +00:00
tag: ${{ github.ref }}
2023-02-24 08:29:50 +00:00
overwrite: true
2023-11-01 07:36:38 +00:00
docker:
runs-on: ubuntu-latest
name: Build Docker image and push to Docker Hub
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Get image label
id: image_label
2023-11-01 07:41:15 +00:00
run: echo "label=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
2023-11-01 07:36:38 +00:00
- name: Build container image
uses: docker/build-push-action@v5
with:
push: true
platforms: linux/amd64,linux/arm64
context: './'
no-cache: true
file: 'Dockerfile'
tags: radialapps/go-vod:${{ steps.image_label.outputs.label }} , radialapps/go-vod:latest
provenance: false