2022-01-11 05:11:15 -08:00
|
|
|
# Expected secrets
|
|
|
|
# MAVEN_CENTRAL_USERNAME - Username for Maven Central
|
|
|
|
# MAVEN_CENTRAL_PASSWORD - Password for Maven Central
|
|
|
|
|
|
|
|
# Note that snapshot releases do not require GPG signing
|
|
|
|
|
|
|
|
name: Deploy Snapshot
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
push:
|
|
|
|
branches:
|
2022-06-07 07:43:01 -07:00
|
|
|
- main
|
2022-01-11 05:11:15 -08:00
|
|
|
paths-ignore:
|
|
|
|
- '.github/ISSUE_TEMPLATE/*'
|
|
|
|
- '.github/PULL_REQUEST_TEMPLATE.md'
|
|
|
|
- 'LICENSE'
|
|
|
|
- 'README.md'
|
|
|
|
- 'docs/**'
|
|
|
|
|
|
|
|
concurrency: deploy_snapshot
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
validate_gradle_wrapper:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
timeout-minutes: 1
|
2022-10-04 18:58:21 -07:00
|
|
|
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
|
2022-01-11 05:11:15 -08:00
|
|
|
# Gradle Wrapper validation can be flaky
|
|
|
|
# https://github.com/gradle/wrapper-validation-action/issues/40
|
|
|
|
- name: Gradle Wrapper Validation
|
|
|
|
timeout-minutes: 1
|
2022-03-07 09:33:02 -08:00
|
|
|
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b
|
2022-01-11 05:11:15 -08:00
|
|
|
|
2022-08-16 05:53:23 -07:00
|
|
|
check_secrets:
|
|
|
|
environment: deployment
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
has-secrets: ${{ steps.check_secrets.outputs.defined }}
|
|
|
|
steps:
|
|
|
|
- id: check_secrets
|
|
|
|
env:
|
|
|
|
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
|
|
|
|
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
|
|
|
|
if: "${{ env.MAVEN_CENTRAL_USERNAME != '' && env.MAVEN_CENTRAL_PASSWORD != '' }}"
|
|
|
|
run: echo "::set-output name=defined::true"
|
|
|
|
|
2022-01-11 05:11:15 -08:00
|
|
|
deploy_snapshot:
|
2022-02-02 12:10:29 -08:00
|
|
|
environment: deployment
|
2022-08-16 05:53:23 -07:00
|
|
|
needs: [validate_gradle_wrapper, check_secrets]
|
2022-01-11 05:11:15 -08:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
timeout-minutes: 1
|
2022-10-04 18:58:21 -07:00
|
|
|
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
|
2022-01-11 05:11:15 -08:00
|
|
|
- name: Setup
|
|
|
|
id: setup
|
2022-01-27 12:53:53 -08:00
|
|
|
timeout-minutes: 30
|
2022-01-11 05:11:15 -08:00
|
|
|
uses: ./.github/actions/setup
|
|
|
|
# While not strictly necessary, this sanity checks the build before attempting to upload.
|
|
|
|
# This adds minimal additional build time, since most of the work is cached and re-used
|
|
|
|
# in the next step.
|
|
|
|
- name: Deploy to Maven Local
|
|
|
|
timeout-minutes: 25
|
2022-01-26 13:18:41 -08:00
|
|
|
env:
|
|
|
|
ORG_GRADLE_PROJECT_IS_SNAPSHOT: true
|
2022-01-11 05:11:15 -08:00
|
|
|
run: |
|
2022-08-16 05:53:23 -07:00
|
|
|
./gradlew publishReleasePublicationToMavenLocalRepository --no-parallel
|
2022-01-11 05:11:15 -08:00
|
|
|
- name: Deploy to Maven Central
|
2022-03-15 11:06:58 -07:00
|
|
|
timeout-minutes: 8
|
2022-01-11 05:11:15 -08:00
|
|
|
env:
|
2022-08-16 05:53:23 -07:00
|
|
|
ORG_GRADLE_PROJECT_ZCASH_MAVEN_PUBLISH_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
|
|
|
|
ORG_GRADLE_PROJECT_ZCASH_MAVEN_PUBLISH_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
|
2022-01-11 05:11:15 -08:00
|
|
|
ORG_GRADLE_PROJECT_IS_SNAPSHOT: true
|
|
|
|
run: |
|
2022-08-16 05:53:23 -07:00
|
|
|
./gradlew publishReleasePublicationToMavenCentralRepository --no-parallel
|
2022-01-11 05:11:15 -08:00
|
|
|
- name: Collect Artifacts
|
|
|
|
timeout-minutes: 1
|
|
|
|
if: ${{ always() }}
|
|
|
|
env:
|
|
|
|
ARTIFACTS_DIR_PATH: ${{ format('{0}/artifacts', env.home) }}
|
|
|
|
BINARIES_ZIP_PATH: ${{ format('{0}/artifacts/snapshot_binaries.zip', env.home) }}
|
|
|
|
run: |
|
|
|
|
mkdir ${ARTIFACTS_DIR_PATH}
|
|
|
|
|
2022-02-03 10:08:35 -08:00
|
|
|
zip -r ${BINARIES_ZIP_PATH} . -i *build/outputs/*
|
2022-01-11 05:11:15 -08:00
|
|
|
- name: Upload Artifacts
|
|
|
|
if: ${{ always() }}
|
2022-06-16 02:58:18 -07:00
|
|
|
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8
|
2022-08-23 23:30:18 -07:00
|
|
|
timeout-minutes: 2
|
2022-01-11 05:11:15 -08:00
|
|
|
with:
|
|
|
|
name: Snapshot binaries
|
|
|
|
path: ~/artifacts
|