mirror of
https://github.com/vx3r/wg-gen-web.git
synced 2024-11-22 02:31:57 +01:00
update docker workflow
This commit is contained in:
parent
e5a94ae59f
commit
b0702c01d5
74
.github/workflows/dockerimage.yml
vendored
74
.github/workflows/dockerimage.yml
vendored
@ -1,4 +1,4 @@
|
|||||||
name: Build multi-arch Docker Images via buildx
|
name: Build multi-platform docker images via buildx
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
@ -7,40 +7,60 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
|
tags:
|
||||||
|
- 'v*.*.*'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
docker-buildx:
|
docker:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
|
||||||
DOCKER_IMAGE_NAME: vx3r/wg-gen-web
|
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v1
|
uses: actions/checkout@v2
|
||||||
-
|
-
|
||||||
name: Set sha_short
|
name: Set Prepare
|
||||||
id: vars
|
id: prep
|
||||||
run: echo ::set-output name=sha_short::$(git rev-parse --short HEAD)
|
run: |
|
||||||
|
DOCKER_IMAGE=vx3r/wg-gen-web
|
||||||
|
VERSION=edge
|
||||||
|
if [[ $GITHUB_REF == refs/tags/* ]]; then
|
||||||
|
VERSION=${GITHUB_REF#refs/tags/}
|
||||||
|
elif [[ $GITHUB_REF == refs/heads/* ]]; then
|
||||||
|
VERSION=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g')
|
||||||
|
elif [[ $GITHUB_REF == refs/pull/* ]]; then
|
||||||
|
VERSION=pr-${{ github.event.number }}
|
||||||
|
fi
|
||||||
|
TAGS="${DOCKER_IMAGE}:${VERSION}"
|
||||||
|
if [ "${{ github.event_name }}" = "push" ]; then
|
||||||
|
TAGS="$TAGS,${DOCKER_IMAGE}:sha-${GITHUB_SHA::8}"
|
||||||
|
fi
|
||||||
|
echo ::set-output name=version::${VERSION}
|
||||||
|
echo ::set-output name=tags::${TAGS}
|
||||||
|
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
|
||||||
|
echo ::set-output name=sha_short::$(git rev-parse --short HEAD)
|
||||||
-
|
-
|
||||||
name: Build Docker Images Only
|
name: Set up QEMU
|
||||||
if: github.event_name == 'pull_request'
|
uses: docker/setup-qemu-action@v1
|
||||||
uses: ilteoood/docker_buildx@master
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
|
-
|
||||||
|
name: Login to DockerHub
|
||||||
|
uses: docker/login-action@v1
|
||||||
with:
|
with:
|
||||||
publish: false
|
username: ${{ secrets.DOCKER_LOGIN_USERNAME }}
|
||||||
tag: dev
|
password: ${{ secrets.DOCKER_LOGIN_PASSWORD }}
|
||||||
dockerFile: ./Dockerfile
|
|
||||||
platform: linux/amd64,linux/arm64,linux/arm/v7
|
|
||||||
imageName: ${{ env.DOCKER_IMAGE_NAME }}
|
|
||||||
-
|
-
|
||||||
name: Build and Publish Docker Images
|
name: Build and push
|
||||||
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
uses: docker/build-push-action@v2
|
||||||
uses: ilteoood/docker_buildx@master
|
|
||||||
with:
|
with:
|
||||||
publish: true
|
context: .
|
||||||
tag: latest
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
||||||
dockerFile: ./Dockerfile
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
platform: linux/amd64,linux/arm64,linux/arm/v7
|
tags: ${{ steps.prep.outputs.tags }}
|
||||||
imageName: ${{ env.DOCKER_IMAGE_NAME }}
|
labels: |
|
||||||
dockerHubUser: ${{ secrets.DOCKER_LOGIN_USERNAME }}
|
org.opencontainers.image.source=${{ github.event.repository.html_url }}
|
||||||
dockerHubPassword: ${{ secrets.DOCKER_LOGIN_PASSWORD }}
|
org.opencontainers.image.created=${{ steps.prep.outputs.created }}
|
||||||
buildArg: COMMIT=${{ steps.vars.outputs.sha_short }}
|
org.opencontainers.image.revision=${{ github.sha }}
|
||||||
|
build-args: |
|
||||||
|
COMMIT=${{ steps.prep.outputs.version }}
|
Loading…
Reference in New Issue
Block a user