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
|
2023-06-12 02:42:25 -07:00
|
|
|
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
|
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
|
2023-02-20 07:51:44 -08:00
|
|
|
uses: gradle/wrapper-validation-action@8d49e559aae34d3e0eb16cde532684bc9702762b
|
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 != '' }}"
|
2022-12-28 18:23:27 -08:00
|
|
|
run: echo "defined=true" >> $GITHUB_OUTPUT
|
2022-08-16 05:53:23 -07:00
|
|
|
|
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
|
2023-06-12 02:42:25 -07:00
|
|
|
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
|
2022-01-11 05:11:15 -08:00
|
|
|
- name: Setup
|
|
|
|
id: setup
|
2023-03-29 11:44:28 -07:00
|
|
|
timeout-minutes: 40
|
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() }}
|
2023-01-09 05:10:59 -08:00
|
|
|
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce
|
2023-01-12 07:30:35 -08:00
|
|
|
timeout-minutes: 3
|
2022-01-11 05:11:15 -08:00
|
|
|
with:
|
|
|
|
name: Snapshot binaries
|
|
|
|
path: ~/artifacts
|