0.0.5 #6
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: | |
release: | |
types: | |
- published | |
jobs: | |
# step 1) take the sha we are on, and push a tag matching the release name | |
promote_tag: | |
name: 'Promote Tag' | |
timeout-minutes: 7 | |
runs-on: 'ubuntu-latest' | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: "zulu" | |
java-version: "17" | |
# get the associated sha | |
- name: Get Existing Tag | |
run: echo "tag=sha-$(git rev-parse --short=7 HEAD)" >> $GITHUB_OUTPUT | |
id: current-tag | |
# login to the registry | |
- name: Log into registry | |
timeout-minutes: 5 | |
uses: docker/login-action@1f401f745bf57e30b3a2800ad308a87d2ebdf14b | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# get the version from gradle, this is used in the chart | |
# we need to ensure this tag exists before publishing the chart | |
- name: Output Gradle Version | |
id: version | |
run: | | |
echo "New version will be $(./gradlew --console=plain -q printVersion)" | |
echo "version=$(./gradlew --console=plain -q printVersion | head -n 3 | tail -1)" >> $GITHUB_OUTPUT | |
# retag, this is same repo but could be tweaked to push to a prod repo | |
- name: Promote Tag | |
run: | | |
skopeo copy --all docker://ghcr.io/${{ github.repository }}:${{ steps.current-tag.outputs.tag }} \ | |
docker://ghcr.io/${{ github.repository }}:${{ steps.version.outputs.version }} | |
# step 2) build and publish the helm chart to an oci repo. | |
publish_chart: | |
name: 'Publish Chart' | |
runs-on: 'ubuntu-latest' | |
timeout-minutes: 7 | |
needs: | |
- promote_tag | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: "zulu" | |
java-version: "17" | |
# login to the registry for oci pushes | |
- name: Log into registry | |
timeout-minutes: 5 | |
uses: docker/login-action@1f401f745bf57e30b3a2800ad308a87d2ebdf14b | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# use gradle tasks to build the chart | |
- name: Execute Gradle Tasks | |
uses: gradle/gradle-build-action@v2.9.0 | |
with: | |
gradle-version: 8.3 | |
arguments: k8sResource k8sHelm | |
- name: Pack Helm Sub Charts | |
run: | | |
cd build/jkube/helm/$(./gradlew --console=plain -q printProjectName)/kubernetes/ && \ | |
helm repo add groundhog2k https://groundhog2k.github.io/helm-charts/ && \ | |
helm dependency update && \ | |
helm dependency build && \ | |
helm package . && \ | |
helm push *.tgz oci://ghcr.io/${{ github.repository_owner }}/helm |