Merge pull request #6 from freekode/electron-ui #17
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" | |
build-jar: | |
uses: ./.github/workflows/build-jar.yml | |
with: | |
jar-name: tp2intervals | |
jar-artifact-name: tp2intervals-jar | |
docker: | |
name: Docker Image Release | |
runs-on: ubuntu-latest | |
needs: | |
- get-version | |
- build-jar | |
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/download-artifact@master | |
with: | |
name: tp2intervals-jar | |
path: artifact | |
- name: Build image | |
run: docker build . --file Dockerfile --tag $IMAGE_NAME | |
- 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: | |
- build-jar | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-java@v3 | |
with: | |
java-version: 21 | |
distribution: 'corretto' | |
cache: 'gradle' | |
- uses: actions/download-artifact@master | |
with: | |
name: tp2intervals-jar | |
path: artifact | |
- uses: ncipollo/release-action@v1 | |
with: | |
draft: true | |
generateReleaseNotes: true | |
artifactErrorsFailBuild: true | |
artifacts: artifact/*.jar |