chore(deps): bump hibare/.github in the actions group across 1 direct… #35
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test, Build & Publish | |
on: | |
push: | |
tags: | |
- "v*" | |
branches: | |
- main | |
pull_request: | |
branches: | |
- "main" | |
- "dev" | |
paths-ignore: | |
- "**/README.md" | |
- "**/Makefile" | |
- "**/.env.**" | |
- "**/docker-compose.*.yml" | |
- "**/.vscode" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }} | |
cancel-in-progress: true | |
jobs: | |
docker-image-test-publish: | |
# Trigger on pull request, push to main and tag creation | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
id-token: write # For cosign | |
packages: write # For GHCR | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Set Metadata | |
id: set-metadata | |
run: | | |
DOCKER_TAGS="unknown" | |
VERSION="unknown" | |
IMAGE_NAMES="hibare/gopg2s3dump ghcr.io/hibare/gopg2s3dump" | |
if [ "${{ github.event_name }}" == "push" ]; then | |
if [ "${{ github.ref }}" == "refs/heads/main" ]; then | |
DOCKER_TAGS="next" | |
VERSION="next" | |
elif [[ "${{ github.ref }}" == "refs/tags/v"* ]]; then | |
DOCKER_TAGS="type=semver,pattern={{version}} type=semver,pattern={{major}}" | |
VERSION="${GITHUB_REF#refs/tags/v}" | |
else | |
echo "Unknown ref: ${{ github.ref }}" | |
exit 1 | |
fi | |
elif [ "${{ github.event_name }}" == "pull_request" ]; then | |
DOCKER_TAGS="test" | |
VERSION="test" | |
else | |
echo "Unknown event: ${{ github.event_name }}" | |
exit 1 | |
fi | |
GOLANG_VERSION=$(grep -oP '^go (\d+(\.\d+)*)' go.mod | awk '{print $2}') | |
echo "docker_image_names=$IMAGE_NAMES" >> $GITHUB_OUTPUT | |
echo "docker_tags=$DOCKER_TAGS" >> $GITHUB_OUTPUT | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
echo "golang_version=$GOLANG_VERSION" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: image-build-publish | |
uses: hibare/.github/github/shared-workflows/docker-image-build-publish@038e5ef85c308f76e396c8a886a7ae31b8494367 # v0.6.0 | |
with: | |
image_names: ${{ steps.set-metadata.outputs.docker_image_names }} | |
tags: ${{ steps.set-metadata.outputs.docker_tags }} | |
platforms: linux/386,linux/amd64,linux/arm/v7,linux/arm64 | |
push_dockerhub: ${{ github.event_name != 'pull_request' }} | |
push_ghcr: ${{ github.event_name != 'pull_request' }} | |
build_args: VERSION=${{ steps.set-metadata.outputs.version }} GOLANG_VERSION=${{ steps.set-metadata.outputs.golang_version }} | |
env: | |
DOCKERHUB_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
DOCKERHUB_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |