Skip to content

ci: remove branch ignore workaround #16

ci: remove branch ignore workaround

ci: remove branch ignore workaround #16

name: 📦 Build and Publish a WBS Image Release to Dockerhub
on:
push:
tags:
- 'elasticsearch@*'
- 'quickstatements@*'
- 'wdqs@*'
- 'wdqs-frontend@*'
- 'wdqs-proxy@*'
- 'wikibase@*'
permissions:
contents: write
packages: write
jobs:
extract_tag_and_publish:
runs-on: ubuntu-latest
steps:
- name: Extract image name and confirm it is a valid semantic version tag
id: extract_tag
run: |
set -x # show commands
# Extract the tag name
TAG_NAME=$(echo ${{ github.ref }} | sed 's/refs\/tags\///')
# Use regex to extract the imageName before the @ and confirm the version is valid semver version tag
if [[ "$TAG_NAME" =~ ^([^@]+)@([0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?)$ ]]; then
# Store image name in environment for later steps
echo "IMAGE_NAME=${BASH_REMATCH[1]}" >> $GITHUB_ENV
else
echo "Tag does not match the pattern {imageName}@{semantic-version}"
exit 1
fi
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-environment
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/login-action@v3
with:
# implicitly docker hub
username: wmdetravisbot
password: ${{ secrets.WBS_PUBLISH_TOKEN }}
- name: Build image and push to Dockerhub with release tags
run: |
set -e # abort on error
set -x # show commands
./nx release publish -p $IMAGE_NAME