This commit is contained in:
Vladislav Yarmak 2023-10-07 20:25:14 +03:00
parent 36316555a3
commit 5280b0414d
2 changed files with 61 additions and 44 deletions

37
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,37 @@
name: build
on:
push:
tags:
- 'v*'
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
-
name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
-
name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 'stable'
-
name: Build
run: >-
make -j $(nproc) allplus
NDK_CC_ARM64="$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang"
NDK_CC_ARM="$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi21-clang"
-
name: Release
uses: softprops/action-gh-release@v1
with:
files: bin/*
fail_on_unmatched_files: true
generate_release_notes: true

View File

@ -2,14 +2,8 @@ name: docker-ci
on: on:
push: push:
branches: tags:
- 'master' - 'v*.*.*'
release:
types: [published]
env:
DOCKER_BUILDKIT: 1
DOCKER_TAG_PREFIX: ${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }}
jobs: jobs:
docker: docker:
@ -17,7 +11,7 @@ jobs:
steps: steps:
- -
name: Checkout name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
- -
@ -30,53 +24,39 @@ jobs:
commit-ish: 'HEAD' commit-ish: 'HEAD'
skip-unshallow: 'true' skip-unshallow: 'true'
abbrev: 7 abbrev: 7
- - name: Docker meta
name: Determine scratch image tag type id: meta
uses: haya14busa/action-cond@v1 uses: docker/metadata-action@v5
id: imgtag_scratch
with: with:
cond: ${{ github.event_name == 'release' }} # list of Docker images to use as base name for tags
if_true: ${{ env.DOCKER_TAG_PREFIX }}:${{ github.event.release.tag_name }},${{ env.DOCKER_TAG_PREFIX }}:latest images: |
if_false: ${{ env.DOCKER_TAG_PREFIX }}:latest ${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }}
- # generate Docker tags based on the following events/attributes
name: Determine Alpine image tag type tags: |
uses: haya14busa/action-cond@v1 type=semver,pattern={{version}}
id: imgtag_alpine type=semver,pattern={{major}}.{{minor}}
with: type=semver,pattern={{major}}
cond: ${{ github.event_name == 'release' }} type=sha
if_true: ${{ env.DOCKER_TAG_PREFIX }}:${{ github.event.release.tag_name }}-alpine,${{ env.DOCKER_TAG_PREFIX }}:latest-alpine
if_false: ${{ env.DOCKER_TAG_PREFIX }}:latest-alpine
- -
name: Set up QEMU name: Set up QEMU
uses: docker/setup-qemu-action@v2 uses: docker/setup-qemu-action@v3
- -
name: Set up Docker Buildx name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v3
- -
name: Login to DockerHub name: Login to DockerHub
uses: docker/login-action@v2 uses: docker/login-action@v3
with: with:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
- -
name: Build and push scratch image name: Build and push
id: docker_build_scratch id: docker_build
uses: docker/build-push-action@v4 uses: docker/build-push-action@v5
with: with:
context: . context: .
platforms: linux/amd64,linux/arm64,linux/386,linux/arm/v7 platforms: linux/amd64,linux/arm64,linux/386,linux/arm/v7
push: true push: true
tags: ${{ steps.imgtag_scratch.outputs.value }} tags: ${{ steps.meta.outputs.tags }}
target: scratch labels: ${{ steps.meta.outputs.labels }}
build-args: 'GIT_DESC=${{ steps.tagger.outputs.tag }}'
-
name: Build and push Alpine image
id: docker_build_alpine
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64,linux/386,linux/arm/v7
push: true
tags: ${{ steps.imgtag_alpine.outputs.value }}
target: alpine
build-args: 'GIT_DESC=${{steps.tagger.outputs.tag}}' build-args: 'GIT_DESC=${{steps.tagger.outputs.tag}}'