v0.0.3 #14
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: release | |
on: | |
push: | |
tags: [v*] | |
workflow_dispatch: | |
env: | |
IMAGE_NAME: tp2intervals | |
JAR_NAME: tp2intervals | |
jobs: | |
get-version: | |
name: Get version | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.get-version.outputs.version }} | |
steps: | |
- id: get-version | |
run: | | |
# Strip git ref prefix from version | |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
# Strip "v" prefix from tag name | |
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') | |
# Use Docker `latest` tag convention | |
[ "$VERSION" == "main" ] && VERSION=latest | |
echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
docker: | |
name: Docker Image Release | |
runs-on: ubuntu-latest | |
needs: | |
- get-version | |
steps: | |
- env: | |
version: ${{needs.get-version.outputs.version}} | |
run: echo "current version is $version" | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-java@v3 | |
with: | |
java-version: 21 | |
distribution: 'corretto' | |
cache: 'gradle' | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20.10.0 | |
- name: Build backend | |
working-directory: ./boot | |
run: ./gradlew build | |
- name: Build frontend | |
working-directory: ./ui | |
run: npm ci && npm run build | |
- name: Build image | |
env: | |
VERSION: ${{needs.get-version.outputs.version}} | |
run: docker build . --file Dockerfile --tag $IMAGE_NAME --build-arg JAR_NAME=$JAR_NAME-$VERSION.jar | |
- name: Log into registry | |
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin | |
- name: Push image | |
env: | |
VERSION: ${{needs.get-version.outputs.version}} | |
run: | | |
IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME | |
# Change all uppercase to lowercase | |
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | |
echo IMAGE_ID=$IMAGE_ID | |
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION | |
docker tag $IMAGE_NAME $IMAGE_ID:latest | |
docker push $IMAGE_ID:$VERSION | |
docker push $IMAGE_ID:latest | |
jar: | |
name: Jar Release | |
runs-on: ubuntu-latest | |
needs: | |
- get-version | |
steps: | |
- env: | |
version: ${{needs.get-version.outputs.version}} | |
run: echo "current version is $version" | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-java@v3 | |
with: | |
java-version: 21 | |
distribution: 'corretto' | |
cache: 'gradle' | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20.10.0 | |
- name: Build frontend | |
working-directory: ./ui | |
run: npm ci && npm run build | |
- name: Copy UI | |
run: cp -r ui/dist/ui/browser/ boot/src/main/resources/static | |
- name: Build backend | |
working-directory: ./boot | |
run: ./gradlew build | |
- uses: ncipollo/release-action@v1 | |
env: | |
VERSION: ${{needs.get-version.outputs.version}} | |
with: | |
draft: true | |
generateReleaseNotes: true | |
artifactErrorsFailBuild: true | |
artifacts: boot/build/libs/tp2intervals-${{ env.VERSION }}.jar |