Post Release #6
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
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven | |
name: Post Release | |
on: | |
workflow_dispatch: | |
inputs: | |
snapshot: | |
description: 'Version of Java packages to restore. e.g. 2.1-SNAPSHOT' | |
required: true | |
jobs: | |
set-versions: | |
concurrency: post-release-${{ github.ref }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check branch | |
if: ${{ github.ref == 'master' }} | |
uses: actions/github-script@v3 | |
with: | |
script: | | |
core.setFailed('This workflow can not run on master branch') | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11.x' | |
distribution: 'adopt' | |
cache: maven | |
- name: Restore Snapshots | |
env: | |
SNAPSHOT_VERSION: ${{ github.event.inputs.snapshot }} | |
run: | | |
# restore versions snapshot | |
echo "Initializing git" | |
git config user.name github-actions | |
git config user.email [email protected] | |
echo | |
echo "Restoring snapshot version tp $SNAPSHOT_VERSION" | |
mvn versions:set -DnewVersion=$SNAPSHOT_VERSION -DprocessAllModules -DgenerateBackupPoms=false -Pprinting,binary,printingbundle | |
mvn versions:set-property -f project/standard/templates/web/pom.xml -Dproperty=mapstore-services.version -DnewVersion=$SNAPSHOT_VERSION -DgenerateBackupPoms=false -DautoVersionSubmodules=true -Pprinting | |
npm version patch --git-tag-version=false | |
echo "Committing changes" | |
find . -name 'pom.xml' | xargs git add | |
git add package.json | |
git commit -m "Restore java packages to $SNAPSHOT_VERSION and update package.json" | |
- name: "Push to protected branch" | |
uses: CasperWA/push-protected@v2 | |
with: | |
# This requires a special token to be able to trigger checks on new branch creation | |
# admin permissions are required to temporarily disable branch protection for reviews | |
token: ${{ secrets.PUSH_PROTECTED }} | |
ref: ${{ github.ref }} | |
unprotect_reviews: true |