1.0.0-RC6 #21
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: Publish package to GitHub Packages | |
on: | |
release: | |
types: [created] | |
env: | |
DOCKERFILE: Dockerfile.test-only | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 | |
id: cache | |
with: | |
key: OpenJDK11U-jdk_x64_linux_hotspot_11.0.18_10.tar.gz | |
path: | | |
- ${{ runner.temp }}/jdkfile.tar.gz | |
- ${{ runner.temp }}/jdkfile.sha256 | |
- uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 | |
# jdkfile version hash was locally computed and checked against https://github.com/paketo-buildpacks/adoptium/releases | |
- if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
echo "4a29efda1d702b8ff38e554cf932051f40ec70006caed5c4857a8cbc7a0b7db7 ${{ runner.temp }}/jdkfile.tar.gz" >> ${{ runner.temp }}/jdkfile.sha256 | |
echo {{ runner.temp }}/jdkfile.sha256 | |
curl -L "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.18%2B10/OpenJDK11U-jdk_x64_linux_hotspot_11.0.18_10.tar.gz" -o "${{ runner.temp }}/jdkfile.tar.gz" | |
sha256sum --check --status "${{ runner.temp }}/jdkfile.sha256" | |
- uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2 | |
with: | |
distribution: "jdkfile" | |
jdkFile: "${{ runner.temp }}/jdkfile.tar.gz" | |
java-version: "11" | |
- name: Validate Gradle wrapper | |
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b | |
- name: Make gradlew executable | |
run: chmod +x ./gradlew | |
- name: Publish package | |
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1 | |
with: | |
arguments: publish | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Make spring sample gradlew executable | |
run: chmod +x ./gradlew | |
working-directory: ./samples/spring | |
- name: Run build with Gradle Wrapper on Spring Sample | |
run: ./gradlew bootJar | |
working-directory: ./samples/spring | |
- name: Log in to the Container registry | |
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
secrets: | | |
"GITHUB_ACTOR=${{ secrets.GITHUB_ACTOR }}" | |
"GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" |