Skip to content

Commit

Permalink
fix: Update release to publish to artifactory
Browse files Browse the repository at this point in the history
  • Loading branch information
ovidiupopa07 committed Mar 7, 2024
1 parent 8080888 commit baf4220
Showing 1 changed file with 8 additions and 95 deletions.
103 changes: 8 additions & 95 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ on:
env:
GRADLE_OPTS: -Dorg.gradle.daemon=false -Xmx6g -Xms6g -Dorg.gradle.internal.http.socketTimeout=120000 -Dorg.gradle.internal.http.connectionTimeout=120000 -Dorg.gradle.internal.remote.repository.deploy.max.attempts=6
CONTAINER_REGISTRY: us-docker.pkg.dev/spinnaker-community/docker

JFROG_ARGS: --fail=false --url https://armory.jfrog.io/armory/ --user ${{secrets.ARTIFACTORY_USER}} --password ${{secrets.ARTIFACTORY_PASSWORD}}
GRADLE_ARGS: -Partifactory_user=${{secrets.ARTIFACTORY_USER}} -Partifactory_password=${{secrets.ARTIFACTORY_PASSWORD}}
jobs:
release:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -37,10 +38,6 @@ jobs:
fi
echo "exactly one branch ($BRANCHES)"
echo BRANCH=$BRANCHES >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- uses: actions/setup-java@v3
with:
java-version: 11
Expand All @@ -56,94 +53,10 @@ jobs:
echo SKIP_RELEASE="${SKIP_RELEASE}" >> $GITHUB_OUTPUT
echo IS_CANDIDATE="${IS_CANDIDATE}" >> $GITHUB_OUTPUT
echo RELEASE_VERSION="${RELEASE_VERSION}" >> $GITHUB_OUTPUT
- name: Prepare build variables
id: build_variables
run: |
echo REPO="${GITHUB_REPOSITORY##*/}" >> $GITHUB_OUTPUT
echo VERSION="$(git rev-parse --short HEAD)-$(date --utc +'%Y%m%d%H%M')" >> $GITHUB_OUTPUT
- name: Release build
env:
ORG_GRADLE_PROJECT_version: ${{ steps.release_info.outputs.RELEASE_VERSION }}
ORG_GRADLE_PROJECT_nexusPublishEnabled: true
ORG_GRADLE_PROJECT_nexusUsername: ${{ secrets.NEXUS_USERNAME }}
ORG_GRADLE_PROJECT_nexusPassword: ${{ secrets.NEXUS_PASSWORD }}
ORG_GRADLE_PROJECT_nexusPgpSigningKey: ${{ secrets.NEXUS_PGP_SIGNING_KEY }}
ORG_GRADLE_PROJECT_nexusPgpSigningPassword: ${{ secrets.NEXUS_PGP_SIGNING_PASSWORD }}
- name: Publish Release
run: |
./gradlew --info build ${{ steps.build_variables.outputs.REPO }}-web:installDist publishToNexus closeAndReleaseNexusStagingRepository
- name: Publish apt packages to Google Artifact Registry
env:
ORG_GRADLE_PROJECT_version: ${{ steps.release_info.outputs.RELEASE_VERSION }}
ORG_GRADLE_PROJECT_artifactRegistryPublishEnabled: true
GAR_JSON_KEY: ${{ secrets.GAR_JSON_KEY }}
run: |
./gradlew --info publish
- name: Login to Google Cloud
# Only run this on repositories in the 'spinnaker' org, not on forks.
if: startsWith(github.repository, 'spinnaker/')
uses: 'google-github-actions/auth@v1'
# use service account flow defined at: https://github.com/google-github-actions/upload-cloud-storage#authenticating-via-service-account-key-json
with:
credentials_json: '${{ secrets.GAR_JSON_KEY }}'
- name: Upload halconfig profiles to GCS
# https://console.cloud.google.com/storage/browser/halconfig
# Only run this on repositories in the 'spinnaker' org, not on forks.
if: startsWith(github.repository, 'spinnaker/')
uses: 'google-github-actions/upload-cloud-storage@v1'
with:
path: 'halconfig/'
destination: 'halconfig/${{ steps.build_variables.outputs.REPO }}/${{ steps.release_info.outputs.RELEASE_VERSION }}'
parent: false
- name: Login to GAR
# Only run this on repositories in the 'spinnaker' org, not on forks.
if: startsWith(github.repository, 'spinnaker/')
uses: docker/login-action@v2
# use service account flow defined at: https://github.com/docker/login-action#service-account-based-authentication-1
with:
registry: us-docker.pkg.dev
username: _json_key
password: ${{ secrets.GAR_JSON_KEY }}
- name: Build and publish slim container image
# Only run this on repositories in the 'spinnaker' org, not on forks.
if: startsWith(github.repository, 'spinnaker/')
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile.slim
platforms: linux/amd64,linux/arm64
push: true
tags: |
"${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.release_info.outputs.RELEASE_VERSION }}-unvalidated"
"${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.release_info.outputs.RELEASE_VERSION }}-unvalidated-slim"
"${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.release_info.outputs.RELEASE_VERSION }}-${{ steps.build_variables.outputs.VERSION }}-unvalidated-slim"
- name: Build and publish ubuntu container image
# Only run this on repositories in the 'spinnaker' org, not on forks.
if: startsWith(github.repository, 'spinnaker/')
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile.ubuntu
platforms: linux/amd64,linux/arm64
push: true
tags: |
"${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.release_info.outputs.RELEASE_VERSION }}-unvalidated-ubuntu"
"${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.release_info.outputs.RELEASE_VERSION }}-${{ steps.build_variables.outputs.VERSION }}-unvalidated-ubuntu"
- name: Create release
if: steps.release_info.outputs.SKIP_RELEASE == 'false'
uses: softprops/action-gh-release@v1
with:
body: |
${{ steps.release_info.outputs.CHANGELOG }}
draft: false
name: ${{ github.event.repository.name }} ${{ github.ref_name }}
prerelease: ${{ steps.release_info.outputs.IS_CANDIDATE }}
tag_name: ${{ github.ref }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Pause before dependency bump
run: sleep 900
- name: Trigger dependency bump workflow
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.SPINNAKER_GITHUB_TOKEN }}
event-type: bump-dependencies
client-payload: '{"ref": "${{ github.ref }}", "branch": "${{ env.BRANCH}}"}'
./gradlew test artifactoryPublish $GRADLE_ARGS -Pversion=2.32.1
BUILD_NUMBER=$(./gradlew -Prelease.useLastTag=true $GRADLE_ARGS printVersion|grep VERSION|awk -F: '{print $2}')
echo "Running build scan against $BUILD_NUMBER"
jfrog rt bs "kork" "$BUILD_NUMBER" $JFROG_ARGS

0 comments on commit baf4220

Please sign in to comment.