chore: change command to delete tag (#3) #2
Workflow file for this run
This file contains hidden or 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
name: Release | |
on: | |
push: | |
tags: | |
- 'v[0-9]*' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 17 | |
- name: Checkout sources | |
uses: actions/checkout@v1 | |
- name: Remove original tag | |
run: > | |
gh release delete ${{ github.ref_name }} --yes --cleanup-tag | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract tag versions | |
run: | | |
regex="v([0-9]+).([0-9]+).([0-9]+)" | |
if [[ $1 =~ $regex ]] | |
then | |
echo "GITHUB_MAJOR_VERSION=${BASH_REMATCH[1]}" >> $GITHUB_ENV | |
echo "GITHUB_MINOR_VERSION=${BASH_REMATCH[2]}" >> $GITHUB_ENV | |
echo "GITHUB_PATCH_VERSION=${BASH_REMATCH[3]}" >> $GITHUB_ENV | |
fi | |
- name: Change Maven version to release version | |
run: mvn --batch-mode versions:set -DgenerateBackupPoms=false -DnewVersion=${{ env.GITHUB_MAJOR_VERSION }}.${{ env.GITHUB_MINOR_VERSION }}.${{ env.GITHUB_PATCH_VERSION }} | |
- name: Commit and tag release version | |
uses: stefanzweifel/[email protected] | |
with: | |
branch: release-${{ github.ref_name }} | |
create_branch: true | |
commit_message: Prepare release ${{ github.ref_name }} | |
tagging_message: ${{ github.ref_name }} | |
- name: Build with Maven | |
run: mvn --batch-mode -Pjacoco verify | |
- name: Run SonarCloud analysis | |
run: > | |
mvn --batch-mode -DskipTests sonar:sonar | |
-Dsonar.host.url=https://sonarcloud.io | |
-Dsonar.organization=gridsuite | |
-Dsonar.projectKey=gridsuite_spreadsheet-config-server | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
- name: Build Docker image | |
run: > | |
mvn --batch-mode deploy -DskipTests -Dmaven.install.skip -Dmaven.deploy.skip -Dpowsybl.docker.deploy | |
-Djib.httpTimeout=60000 | |
-Djib.to.image=docker.io/gridsuite/spreadsheet-config-server:${GITHUB_REF_NAME#v} | |
-Djib.to.auth.username=gridsuiteci | |
-Djib.to.auth.password=${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Increment minor version | |
run: | | |
minor=${{ env.GITHUB_MINOR_VERSION }} | |
((minor++)) | |
echo "GITHUB_MINOR_VERSION=${minor}" >> $GITHUB_ENV | |
- name: Change Maven version to next version | |
run: mvn --batch-mode versions:set -DgenerateBackupPoms=false -DnewVersion=${{ env.GITHUB_MAJOR_VERSION }}.${{ env.GITHUB_MINOR_VERSION }}.${{ env.GITHUB_PATCH_VERSION }}-SNAPSHOT | |
- name: Commit next version | |
uses: stefanzweifel/[email protected] | |
with: | |
branch: release-${{ github.ref_name }} | |
commit_message: Prepare next release v${{ env.GITHUB_MAJOR_VERSION }}.${{ env.GITHUB_MINOR_VERSION }}.${{ env.GITHUB_PATCH_VERSION }} | |
skip_fetch: true | |
skip_checkout: true | |
- name: Merge automatically into main branch | |
uses: devmasx/[email protected] | |
with: | |
type: now | |
from_branch: release-${{ github.ref_name }} | |
target_branch: main | |
message: Automatic merge after release ${{ github.ref_name }} | |
github_token: ${{ secrets.REPO_ACCESS_TOKEN }} | |
- name: Delete merged branch | |
uses: dawidd6/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branches: release-${{ github.ref_name }} |