Publish release #57
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 (without 'v') | |
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 | |
- uses: pnpm/action-setup@v4 | |
with: | |
version: 9.5.0 | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
cache: 'pnpm' | |
cache-dependency-path: 'src/frontend/pnpm-lock.yaml' | |
- 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 }} | |
- 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/* | |
- 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.zip into cloud overlayer | |
run: cp artifacts/live-v3-*.zip ./src/cloud-instance-docker/live.zip | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./src/cloud-instance-docker/ | |
build-args: USER_ARCHIVE=live.zip | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |