Skip to content

Commit

Permalink
chore: auto build (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
wuassassin authored Dec 24, 2021
1 parent 8f46c64 commit 2a3ada4
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/on-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: On Pull Request

on:
pull_request:
branches: [main]

env:
IMAGE_NAME: ghcr.io/tapalogi/docker-baseimage-musl
DOCKER_BUILDKIT: 1

jobs:
docker-build-test:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Test Docker Build
run: |
# Build Image
docker build --pull -f Dockerfile -t $IMAGE_NAME .
34 changes: 34 additions & 0 deletions .github/workflows/on-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: On Release

on:
release:
types: [published]

env:
IMAGE_NAME: ghcr.io/tapalogi/docker-baseimage-musl
DOCKER_BUILDKIT: 1

jobs:
docker-publish-stable:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Build & Publish
run: |
# Build Image
docker build --pull -f Dockerfile -t docker-image .
# Login Github Docker Registry
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
# Github Package Registry Tag & Push
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
echo IMAGE_NAME=$IMAGE_NAME
echo VERSION=$VERSION
docker tag docker-image $IMAGE_NAME:$VERSION
docker push $IMAGE_NAME:$VERSION
VERSION=latest
docker tag docker-image $IMAGE_NAME:$VERSION
docker push $IMAGE_NAME:$VERSION

0 comments on commit 2a3ada4

Please sign in to comment.