Skip to content

Release

Release #138

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
incrementLevel:
description: 'Version level to increment'
required: true
type: choice
options:
- incrementPatch
- incrementMinor
- incrementMajor
default: 'incrementPatch'
schedule:
- cron: '0 9 * * 2' # every Tuesday at 9 am UTC
jobs:
release:
name: release
runs-on: ubuntu-latest
steps:
- name: Fetch Sources
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Java
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Setup Gradle Cache
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Test
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
SNYK_ORG_NAME: ${{ secrets.SNYK_ORG_NAME }}
run: |
./gradlew test integTest verifyPlugin clean
git clean -d --force
git reset --hard
- name: Create Tag
id: createTag
if: ${{ !env.ACT }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# for cron run we have empty `inputs.incrementLevel`
# see if-then-else alternatives https://stackoverflow.com/questions/60916931/github-action-does-the-if-have-an-else
run: |
if [[ '${{ inputs.incrementLevel }}' != '' ]]; then
./gradlew release -Prelease.versionIncrementer=${{ inputs.incrementLevel }}
else
./gradlew release
fi
echo "::set-output name=tagName::$(./gradlew cV -q -Prelease.quiet)"
- name: Create Tag - Dry Run
id: createTagDry
if: ${{ env.ACT }}
run: |
./gradlew release -Prelease.dryRun
echo "::set-output name=tagName::$(./gradlew cV -q -Prelease.quiet)"
- name: Extract release notes
id: extract-release-notes
uses: ffurrer2/extract-release-notes@v1
- name: Create release
if: ${{ !env.ACT }}
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: "v${{ steps.createTag.outputs.tagName }}"
release_name: "v${{ steps.createTag.outputs.tagName }}"
draft: false
prerelease: false
body: "${{ steps.extract-release-notes.outputs.release_notes }}"
- name: Publish Plugin
if: ${{ !env.ACT }}
env:
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
ORG_GRADLE_PROJECT_amplitudeExperimentApiKey: ${{ secrets.AMPLITUDE_EXPERIMENT_API_KEY }}
ORG_GRADLE_PROJECT_environment: "PRODUCTION"
ORG_GRADLE_PROJECT_iterativelyEnvironment: "PRODUCTION"
ORG_GRADLE_PROJECT_segmentWriteKey: ${{ secrets.SEGMENT_WRITE_KEY }}
run: ./gradlew publishPlugin
# - name: Create Sentry release
# uses: getsentry/action-release@v1
# if: ${{ !env.ACT }}
# env:
# SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
# SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
# SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}