Skip to content

Publish

Publish #22

Workflow file for this run

name: Publish
on:
workflow_dispatch:
jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
cache: gradle
- uses: docker/setup-buildx-action@v3
- name: Run Bootstrap
run: ./bootstrap.sh
- name: Run Gradle Check
run: ./gradlew check
validate-release:
name: Validate Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Validate Changelog
uses: denisa/clq-action@v1
id: changelog
with:
changeMap: .github/clq/changemap.json
mode: release
- name: Validate Tag
uses: denisa/semantic-tag-helper@v1
with:
mode: test
tag: ${{ steps.changelog.outputs.tag }}
publish:
name: Publish
if: github.ref == 'refs/heads/main' && github.repository == 'codebandits/container-gradle-plugin'
needs: [ check, validate-release ]
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v4
- name: Get Changelog
uses: denisa/clq-action@v1
id: changelog
with:
changeMap: .github/clq/changemap.json
mode: release
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
cache: gradle
- name: Load GCP Configuration
uses: codebandits/github-actions/load-env@v1
id: gcp-configuration
with:
path: ./.github/gcp.env
- uses: google-github-actions/auth@v2
with:
project_id: ${{ steps.gcp-configuration.outputs.GCP_PROJECT_ID }}
workload_identity_provider: ${{ steps.gcp-configuration.outputs.GCP_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ steps.gcp-configuration.outputs.GCP_SERVICE_ACCOUNT }}
- name: Install SOPS
uses: mdgreenwald/mozilla-sops-action@v1
- name: Run Bootstrap
run: ./bootstrap.sh
- name: Provide Publishing Secrets
run: sops --decrypt publishing.enc.properties >> gradle.properties
- name: Publish Plugin
run: ./gradlew publishAndReleaseToMavenCentral -Pversion=${{ steps.changelog.outputs.version }}
- name: Remove Publishing Secrets
run: git checkout gradle.properties
- name: Set Tag
uses: denisa/semantic-tag-helper@v1
with:
mode: set
tag: ${{ steps.changelog.outputs.tag }}
- name: Create Release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.changelog.outputs.tag }}
prerelease: ${{ steps.changelog.outputs.status == 'prereleased' }}
name: ${{ steps.changelog.outputs.version }}
body: ${{ steps.changelog.outputs.changes }}