CD - Remove responsability of building and pushing the Docker image f… #4
Workflow file for this run
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: Deliver Application | |
on: | |
push: | |
tags: | |
- 'v*.*.*' | |
workflow_run: | |
types: | |
- completed | |
workflows: | |
- Check Linter Errors | |
jobs: | |
create-release: | |
name: Create Release | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/v') | |
strategy: | |
matrix: | |
node-version: [ 20.x ] | |
pnpm-version: [ 8.x ] | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v3 | |
- run: mkdir build | |
- run: mv src/ build | |
- name: Zip application | |
uses: vimtor/[email protected] | |
with: | |
dest: letsencrypt-acme-challenge-server-${{ github.ref_name }}.zip | |
files: build package.json package-lock.yaml | |
- name: Release application | |
uses: softprops/action-gh-release@v1 | |
with: | |
body: Version ${{ github.ref_name }} of the application | |
body_path: ./CHANGELOG.md | |
files: | | |
letsencrypt-acme-challenge-server-${{ github.ref_name }}.zip | |
fail_on_unmatched_files: true | |
generate_release_notes: true | |
draft: false | |
prerelease: false | |
push-docker-image: | |
name: Push Docker Image | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/v') | |
strategy: | |
matrix: | |
docker-repository: [ juansecu/letsencrypt-acme-challenge-server ] | |
permissions: | |
contents: read | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Log in to registry | |
uses: docker/login-action@v3 | |
with: | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
- name: Build and push the Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
tags: ${{ matrix.docker-repository }}:${{ github.ref_name }},${{ matrix.docker-repository }}:latest |