Skip to content

Post Release

Post Release #10

Workflow file for this run

# 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 github-actions@github.com
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"
git push origin ${{ github.ref_name }}
echo "Snapshots version restored"
- 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