Merge develop to main for release 103 (#121) #15
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: Create a release | |
on: | |
push: | |
tags: | |
- '*' | |
env: | |
REGISTRY: ghcr.io | |
RELEASE_VERSION: ${{ github.ref_name }} | |
jobs: | |
create_release: | |
name: create release bundle | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up JDK 8 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '8' | |
distribution: 'adopt' | |
- name: Cache Gradle packages | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Build with Gradle | |
run: ./gradlew -Pversion=$RELEASE_VERSION clean build release codeCoverageReport | |
- name: Upload the artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: jar_files | |
path: | | |
get-metrics/build/libs/ | |
view-metrics/build/libs/ | |
- name: Create release | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: nexusiq-successmetrics-*.zip | |
build_and_push_image: | |
needs: create_release | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- dockerfile: ./get-metrics/Dockerfile | |
image: ghcr.io/sonatype-nexus-community/nexusiq-successmetrics-get-metrics | |
- dockerfile: ./view-metrics/Dockerfile | |
image: ghcr.io/sonatype-nexus-community/nexusiq-successmetrics-view-metrics | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Download the application files | |
uses: actions/download-artifact@v2 | |
with: | |
name: jar_files | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- uses: docker/setup-buildx-action@v1 | |
id: buildx | |
with: | |
install: true | |
- name: Log in to the Container registry | |
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 | |
with: | |
images: ${{ matrix.image }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc | |
with: | |
context: . | |
file: ${{ matrix.dockerfile }} | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
platforms: linux/amd64,linux/arm64 |