Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor latest tag CI #49

Merged
merged 1 commit into from
Oct 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 31 additions & 19 deletions .github/workflows/build-and-push-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,24 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Release check
id: release
run: |
if [[ ${{ github.ref_name }} =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ ]]; then
echo "release=true" >> $GITHUB_OUTPUT
else
echo "release=false" >> $GITHUB_OUTPUT
fi

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: cytomineuliege/pims
tags: |
type=raw,value=${{ github.ref_name }}-community-plugins
type=raw,value=latest,enable=${{ steps.release.outputs.release }}

- name: Build and push pims
uses: docker/build-push-action@v4
with:
Expand All @@ -39,8 +57,18 @@ jobs:
VIPS_VERSION=${{ vars.VIPS_VERSION }}
context: .
file: ./docker/backend.dockerfile
labels: ${{ steps.meta.outputs.labels }}
push: true
tags: cytomineuliege/pims:${{ github.ref_name }}-community-plugins
tags: ${{ steps.meta.outputs.tags }}

- name: Extract metadata (tags, labels) for Docker
id: meta-worker
uses: docker/metadata-action@v5
with:
images: cytomineuliege/pims-worker
tags: |
type=raw,value=${{ github.ref_name }}-community-plugins
type=raw,value=latest,enable=${{ steps.release.outputs.release }}

- name: Build and push pims-worker
uses: docker/build-push-action@v4
Expand All @@ -50,22 +78,6 @@ jobs:
FROM_VERSION=${{ github.ref_name }}-community-plugins
context: .
file: ./docker/worker.dockerfile
labels: ${{ steps.meta-worker.outputs.labels }}
push: true
tags: cytomineuliege/pims-worker:${{ github.ref_name }}-community-plugins

- name: Release check
id: release
run: |
if [[ ${{ github.ref_name }} =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ ]]; then
echo "release=true" >> $GITHUB_OUTPUT
else
echo "release=false" >> $GITHUB_OUTPUT
fi

- name: Tag latest for official release
if: steps.release.outputs.release == 'true'
run: |
docker tag cytomineuliege/pims:${{ github.ref_name }}-community-plugins cytomineuliege/pims:latest
docker tag cytomineuliege/pims-worker:${{ github.ref_name }}-community-plugins cytomineuliege/pims-worker:latest
docker push cytomineuliege/pims:latest
docker push cytomineuliege/pims-worker:latest
tags: ${{ steps.meta-worker.outputs.tags }}