-
Notifications
You must be signed in to change notification settings - Fork 30
52 lines (48 loc) · 2.49 KB
/
stable.yml
File metadata and controls
52 lines (48 loc) · 2.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: Update stable branch and create stable tag
on:
workflow_run:
workflows:
- Java CI with Maven
branches: [master]
types:
- completed
#pull_request:
# branches: '**'
jobs:
tag:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout master branch
run: git clone https://github.com/OpenTOSCA/container && cd container && git checkout master && git fetch
- name: Lock Winery version
run: cd container && mvn versions:lock-snapshots
- name: Remove -SNAPSHOT
run: cd container && mvn versions:set -DremoveSnapshot
- name: Get POM version
run: cd container && mvn org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | grep -Ev "INFO|WARNING|Download" >> ~/version.log
- name: Set Tag Version in Environment
run: echo "CONTAINER_VERSION="v$(cat ~/version.log)"-"$(date +'%Y-%m-%d-%H-%M-%S') >> $GITHUB_ENV
- name: Show generated version number
run: echo ${{ env.CONTAINER_VERSION }}
- name: Set version number for project
run: cd container && mvn --batch-mode release:update-versions -DautoVersionSubmodules=true -DdevelopmentVersion=${{ env.CONTAINER_VERSION }}
- name: Stash changes
run: cd container && git stash
- name: Config git user
run: git config --global user.email "actions@opentosca.org"
- name: Config git mail
run: git config --global user.name "OpenTOSCA Github Action Stable Workflow"
- name: Checkout stable branch and merge with master
run: cd container && git checkout stable && git checkout stable && git fetch && git revert HEAD --no-edit && git merge master
- name: Pop changes
run: cd container && git stash pop
- name: Commit changes
run: cd container && git commit -a -m "Set stable version ${{ env.CONTAINER_VERSION }}"
- name: Push changes to repo
run: cd container && git push https://actions-user:${{secrets.OPENTOSCAPRIVATEREPOACCESS}}@github.com/OpenTOSCA/container stable --force
- name: Create tag
run: cd container && git tag -a ${{ env.CONTAINER_VERSION }} -m "Autogenerated stable Version ${{ env.CONTAINER_VERSION }}" && git push https://actions-user:${{secrets.OPENTOSCAPRIVATEREPOACCESS}}@github.com/OpenTOSCA/container --tags