parent
ec6a9f9440
commit
671b4be8fb
2 changed files with 23 additions and 16 deletions
|
|
@ -12,18 +12,25 @@ jobs:
|
|||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Login to Docker Registry
|
||||
uses: https://github.com/docker/login-action@v2
|
||||
with:
|
||||
registry: git.itzyanick.de
|
||||
username: ItzYanick
|
||||
password: ${{ secrets.PACKAGE_TOKEN }}
|
||||
- name: Build and push
|
||||
uses: https://github.com/docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
push: true
|
||||
tags: git.itzyanick.de/itzyanick/runner-docker:latest
|
||||
build-args: |
|
||||
CHECKOUT=${{ github.ref }}
|
||||
- name: Set up Docker Buildx
|
||||
uses: https://github.com/docker/setup-buildx-action@v2
|
||||
- name: Log-in to Registry
|
||||
run: echo "${{ secrets.PACKAGE_TOKEN }}" | docker login https://git.itzyanick.de -u ${{ github.actor }} --password-stdin
|
||||
- name: Build and push container image
|
||||
run: |
|
||||
IMAGE_ID=$(echo git.itzyanick.de/${{ github.repository }} | tr '[A-Z]' '[a-z]')
|
||||
# Strip git ref prefix from version
|
||||
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
|
||||
# Strip "v" prefix from tag name
|
||||
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
|
||||
# when the branch is master, replace master with latest
|
||||
[ "$VERSION" == "master" ] && VERSION=latest
|
||||
CHECKOUT=$(echo "${{ github.ref }}" | sed 's|-.*||')
|
||||
echo IMAGE_ID=$IMAGE_ID
|
||||
echo VERSION=$VERSION
|
||||
echo CHECKOUT=$CHECKOUT
|
||||
# Build and Publish container image
|
||||
docker buildx build --push \
|
||||
--tag $IMAGE_ID:$VERSION \
|
||||
--build-arg CHECKOUT=$CHECKOUT \
|
||||
--platform linux/amd64 .
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ RUN apk fix && \
|
|||
apk --no-cache --update add git make
|
||||
|
||||
RUN mkdir /build
|
||||
RUN git clone https://git.itzyanick.de/ItzYanick/runner-docker.git /build/runner \
|
||||
RUN git clone https://code.forgejo.org/forgejo/runner.git /build/runner \
|
||||
&& cd /build/runner \
|
||||
&& git checkout $CHECKOUT
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue