Publish release #47
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: Publish release | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: Name of release | |
required: true | |
publish: | |
type: boolean | |
description: Would release be published | |
required: true | |
default: true | |
draft: | |
type: boolean | |
description: Publish draft first | |
required: true | |
default: true | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }}-instance | |
jobs: | |
build: | |
name: Create artifacts from master | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@master | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
cache: 'npm' | |
cache-dependency-path: 'src/frontend/package-lock.json' | |
- name: Setup Java | |
uses: actions/setup-java@master | |
with: | |
distribution: adopt | |
java-version: 17 | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
- name: Build with gradle | |
run: ./gradlew release --scan -Pnpm.download=false -Pbuild_version=${{ github.event.inputs.version }} -i | |
- name: Upload artifacts | |
uses: actions/upload-artifact@master | |
with: | |
name: artifacts | |
path: artifacts | |
- name: Create release | |
if: ${{ github.event.inputs.publish }} | |
uses: "marvinpinto/action-automatic-releases@latest" | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
prerelease: false | |
automatic_release_tag: "v${{ github.event.inputs.version }}" | |
draft: ${{ github.event.inputs.draft }} | |
files: | | |
artifacts/*.jar | |
- name: Log in to the Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=raw,value=latest | |
type=semver,pattern={{version}},value=${{ github.event.inputs.version }} | |
type=schedule,pattern={{date 'YYYYMMDD'}} | |
- name: Copy live.jar into cloud overlayer | |
run: cp artifacts/live-v3-*.jar ./src/cloud-instance-docker/live.jar | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./src/cloud-instance-docker/ | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |