Skip to content

Deliver Application #10

Deliver Application

Deliver Application #10

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
- name: Setup PNPM
uses: pnpm/action-setup@v3
with:
version: ${{ matrix.pnpm-version }}
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Build application
run: pnpm run build
- run: mkdir build
- run: mv dist/ build
- name: Zip application
uses: vimtor/action-zip@v1.1
with:
dest: github-discord-updater-${{ github.ref_name }}.zip
files: build package.json pnpm-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: |
github-discord-updater-${{ 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/github-discord-updater ]
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