Skip to content

Merge pull request #3 from aranabhat/aranabhat-patch-1 #4

Merge pull request #3 from aranabhat/aranabhat-patch-1

Merge pull request #3 from aranabhat/aranabhat-patch-1 #4

Workflow file for this run

name: Build Jenkins swarm client container
on:
push:
branches:
- master
pull_request:
env:
CONTAINER_NAME: jenkins-swarm-client
jobs:
push:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build swarm image
run: |
docker build . \
--build-arg JSWARM_UID=48435 \
--build-arg JSWARM_GID=202 \
--tag $CONTAINER_NAME \
--label "runnumber=${GITHUB_RUN_ID}"
- name: Log in to GitHub Container Registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
- name: Push images
run: |
CONTAINER_ID=ghcr.io/${{ github.repository_owner }}/$CONTAINER_NAME
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
[ "$VERSION" == "master" ] && VERSION=latest
echo CONTAINER_ID=$CONTAINER_ID
echo VERSION=$VERSION
docker tag $CONTAINER_NAME $CONTAINER_ID:$VERSION
docker push $CONTAINER_ID:$VERSION