Merge pull request #73 from pusher/update-dependencies #5
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
on: | |
push: | |
branches: [ master ] | |
jobs: | |
check-release-tag: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Prepare tag | |
id: prepare_tag | |
continue-on-error: true | |
run: | | |
export TAG=v$(awk '/^version = / { gsub("\"", ""); print $3 }' build.gradle) | |
echo "TAG=$TAG" >> $GITHUB_ENV | |
export CHECK_TAG=$(git tag | grep $TAG) | |
if [[ $CHECK_TAG ]]; then | |
echo "Skipping because release tag already exists" | |
exit 1 | |
fi | |
- name: Output | |
id: release_output | |
if: ${{ steps.prepare_tag.outcome == 'success' }} | |
run: | | |
echo "::set-output name=tag::${{ env.TAG }}" | |
outputs: | |
tag: ${{ steps.release_output.outputs.tag }} | |
create-github-release: | |
runs-on: ubuntu-latest | |
needs: check-release-tag | |
if: ${{ needs.check-release-tag.outputs.tag }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Prepare tag | |
run: | | |
export TAG=v$(awk '/^version = / { gsub("\"", ""); print $3 }' build.gradle) | |
echo "TAG=$TAG" >> $GITHUB_ENV | |
- name: Setup git | |
run: | | |
git config user.email "pusher-ci@pusher.com" | |
git config user.name "Pusher CI" | |
- name: Prepare description | |
run: | | |
csplit -s CHANGELOG.md "/##/" {1} | |
cat xx01 > CHANGELOG.tmp | |
- name: Create Release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ env.TAG }} | |
release_name: ${{ env.TAG }} | |
body_path: CHANGELOG.tmp | |
draft: false | |
prerelease: false | |
publish: | |
runs-on: ubuntu-latest | |
needs: create-github-release | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Create gradle.properties | |
shell: bash | |
run: | | |
mkdir -p _gradle_user_home | |
echo "GRADLE_USER_HOME=_gradle_user_home" >> $GITHUB_ENV | |
cat <<FILE > _gradle_user_home/gradle.properties | |
github.username=${{ secrets.PUSHER_CI_GITHUB_PRIVATE_TOKEN }} | |
github.password="" | |
maven.username=${{ secrets.MAVEN_USERNAME }} | |
maven.password=${{ secrets.MAVEN_PASSWORD }} | |
signing.keyId=${{ secrets.SIGNING_KEY_ID }} | |
signing.password=${{ secrets.SIGNING_PASSWORD }} | |
signing.secretKeyRingFile=_gradle_user_home/pusher-maven-gpg-signing-key.gpg | |
FILE | |
echo "${{ secrets.PUSHER_MAVEN_GPG_SIGNING_KEY }}" | base64 --decode > _gradle_user_home/pusher-maven-gpg-signing-key.gpg | |
- name: Publish | |
run: | | |
./gradlew publish | |
finish-release: | |
runs-on: ubuntu-latest | |
needs: publish | |
env: | |
NEXUS_USERNAME: ${{ secrets.MAVEN_USERNAME }} | |
NEXUS_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} | |
steps: | |
- uses: actions/checkout@v2 | |
- id: get_staging_repository_id | |
name: Get staging repository id | |
run: | | |
echo "staging_repository_id=$(python3 scripts/get_staging_repository_id.py)" >> $GITHUB_OUTPUT | |
- name: Release | |
uses: nexus-actions/release-nexus-staging-repo@main | |
with: | |
username: ${{ secrets.MAVEN_USERNAME }} | |
password: ${{ secrets.MAVEN_PASSWORD }} | |
staging_repository_id: ${{ steps.get_staging_repository_id.outputs.staging_repository_id }} |