Skip to content

Merge pull request #5 from testainers/dev #5

Merge pull request #5 from testainers/dev

Merge pull request #5 from testainers/dev #5

Workflow file for this run

name: CI Build
on:
push:
branches: [ main ]
jobs:
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: write
steps:
- name: Code Checkout
uses: actions/checkout@v4
- name: Get Version
run: |
echo "TAGS=latest" >> $GITHUB_ENV
SUFFIX=""
VERSION=$(grep 'version:' version.yaml | cut -c 10-)$SUFFIX
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "REPO=$GITHUB_REPOSITORY" >> $GITHUB_ENV
echo "OWNER=$GITHUB_REPOSITORY_OWNER" >> $GITHUB_ENV
- name: Check if version is used
run: |
URL=$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/releases/tags/${{ env.VERSION }}
echo "$URL"
CODE=$(curl -s -o /dev/null -w "%{http_code}" "$URL")
if [ "$CODE" != 404 ]; then
echo "Release '$VERSION' already exists. ($CODE)"
exit 1
fi
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/#-action@v3
with:
username: ${{ env.OWNER }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Docker Build & Push
uses: docker/build-push-action@v6
with:
push: true
context: .
file: Dockerfile
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6,linux/386
tags: |
${{ env.REPO }}:${{ env.VERSION }}
${{ env.REPO }}:latest
- name: Creating GitHub Tag
uses: mathieudutour/github-tag-action@v6.2
with:
custom_tag: ${{ env.VERSION }}
tag_prefix: ''
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Create GitHub Release
uses: ncipollo/release-action@v1
with:
tag: ${{ env.VERSION }}
token: ${{ secrets.GITHUB_TOKEN }}