Merge pull request #55 from h0n9/feature/enable-gzip-compression #105
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: ci | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
- develop | |
- feature/* | |
- chore/* | |
tags: | |
- v* | |
paths-ignore: | |
- ".github/**" | |
env: | |
img-registry: ghcr.io/h0n9 | |
img-repository: msg-lake | |
img-tags: ghcr.io/h0n9/msg-lake:tmp | |
img-push: "false" | |
img-platforms: linux/amd64 | |
jobs: | |
build-push: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.img-registry }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: "Set env vars (develop, feature)" | |
if: ${{ github.ref_name == 'develop' || startsWith(github.ref_name, 'feature') }} | |
shell: bash | |
run: | | |
echo "img-tags=${{ env.img-registry }}/${{ env.img-repository }}:dev-${GITHUB_SHA::6}" >> $GITHUB_ENV | |
echo "img-push=true" >> $GITHUB_ENV | |
- name: "Set env vars (tag)" | |
if: ${{ startsWith(github.ref_name, 'v') }} | |
shell: bash | |
run: | | |
echo "img-tags=${{ env.img-registry }}/${{ env.img-repository }}:${GITHUB_REF_NAME},${{ env.img-registry }}/${{ env.img-repository }}:latest" >> $GITHUB_ENV | |
echo "img-push=true" >> $GITHUB_ENV | |
echo "img-platforms=linux/amd64,linux/arm64" >> $GITHUB_ENV | |
- name: Build Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
platforms: ${{ env.img-platforms }} | |
push: ${{ env.img-push }} | |
tags: ${{ env.img-tags }} | |
cache-from: type=gha,scope=msg-lake | |
cache-to: type=gha,mode=max,scope=msg-lake |