Merge pull request #18 from camptocamp/152 #84
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 and push to github packages | |
on: | |
pull_request: | |
branches: | |
- 'master' | |
push: | |
branches: | |
- '*' | |
tags: | |
- '*' | |
jobs: | |
build-images: | |
if: ${{ github.event_name == 'push' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set ENV for branch master/main | |
if: ${{ github.ref == 'refs/heads/master' }} | |
run: echo "RELEASE_VERSION=latest" >> $GITHUB_ENV | |
- name: Set ENV for tags | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
- name: Set ENV for specific branch | |
if: ${{ startsWith(github.ref, 'refs/heads/') && !endsWith(github.ref, '/master') }} | |
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}-${GITHUB_SHA}" >> $GITHUB_ENV | |
- name: Login to GHCR | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build Image Odyssey | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
platforms: linux/amd64 | |
push: true | |
tags: ghcr.io/${{ github.repository }}:${{ env.RELEASE_VERSION }} |