Move to main and skip develop

Using main and develop imposes a complicated release process with Gitflow etc. To simplify our release process we move our development to the main branch skipping develop.
This commit is contained in:
Nanne Baars 2023-01-14 18:24:35 +01:00
parent a0173fd8f8
commit dc0fc09679
5 changed files with 68 additions and 87 deletions

View File

@ -8,8 +8,6 @@ on:
push: push:
branches: branches:
- main - main
- develop
- release/*
tags-ignore: tags-ignore:
- '*' - '*'
paths-ignore: paths-ignore:

View File

@ -13,10 +13,6 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: "Get tag name"
id: tag
uses: dawidd6/action-get-tag@v1
- name: Set up JDK 17 - name: Set up JDK 17
uses: actions/setup-java@v3 uses: actions/setup-java@v3
with: with:
@ -33,8 +29,8 @@ jobs:
- name: "Set labels for ${{ github.ref }}" - name: "Set labels for ${{ github.ref }}"
run: | run: |
echo "WEBGOAT_TAG_VERSION=${{ steps.tag.outputs.tag }}" >> $GITHUB_ENV echo "WEBGOAT_TAG_VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
WEBGOAT_MAVEN_VERSION=${{ steps.tag.outputs.tag }} WEBGOAT_MAVEN_VERSION=${{ github.ref_name }}
echo "WEBGOAT_MAVEN_VERSION=${WEBGOAT_MAVEN_VERSION:1}" >> $GITHUB_ENV echo "WEBGOAT_MAVEN_VERSION=${WEBGOAT_MAVEN_VERSION:1}" >> $GITHUB_ENV
- name: Build with Maven - name: Build with Maven
run: | run: |
@ -105,19 +101,14 @@ jobs:
- name: "Image digest" - name: "Image digest"
run: echo ${{ steps.docker_build.outputs.digest }} run: echo ${{ steps.docker_build.outputs.digest }}
new_version: new_version:
permissions:
contents: write # for Git to git push
if: github.repository == 'WebGoat/WebGoat' if: github.repository == 'WebGoat/WebGoat'
name: Update development version name: Update to next SNAPSHOT version
needs: [ release ] needs: [ release ]
runs-on: ubuntu-latest runs-on: ubuntu-latest
environment:
name: release
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
ref: develop fetch-depth: 0
token: ${{ secrets.WEBGOAT_DEPLOYER_TOKEN }}
- name: Set up JDK 17 - name: Set up JDK 17
uses: actions/setup-java@v3 uses: actions/setup-java@v3
@ -129,10 +120,18 @@ jobs:
run: | run: |
mvn build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion}-SNAPSHOT versions:commit mvn build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion}-SNAPSHOT versions:commit
- name: Commit pom.xml - name: Push the changes to new branch
run: | uses: devops-infra/action-commit-push@v0.9.2
git config user.name webgoat-github with:
git config user.email owasp.webgoat@gmail.com github_token: "${{ secrets.GITHUB_TOKEN }}"
find . -name 'pom.xml' | xargs git add add_timestamp: true
git commit -m "Updating to the new development version" commit_message: "Updating to the new development version"
git push force: false
- name: Create PR
uses: devops-infra/action-pull-request@v0.5.3
with:
github_token: "${{ secrets.GITHUB_TOKEN }}"
title: ${{ github.event.commits[0].message }}
target_branch: main

View File

@ -2,14 +2,11 @@ name: "UI-Test"
on: on:
pull_request: pull_request:
paths-ignore: paths-ignore:
- '.txt'
- '*.MD'
- '*.md'
- 'LICENSE' - 'LICENSE'
- 'docs/**' - 'docs/**'
push: push:
# tags-ignore: tags-ignore:
# - '*' - 'v*'
paths-ignore: paths-ignore:
- '.txt' - '.txt'
- '*.MD' - '*.MD'
@ -24,45 +21,45 @@ jobs:
name: "Robot framework test" name: "Robot framework test"
steps: steps:
# Uses an default action to checkout the code # Uses an default action to checkout the code
- uses: actions/checkout@v3 - uses: actions/checkout@v3
# Uses an action to add Python to the VM # Uses an action to add Python to the VM
- name: Setup Pyton - name: Setup Pyton
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:
python-version: '3.7' python-version: '3.7'
architecture: x64 architecture: x64
# Uses an action to add JDK 17 to the VM (and mvn?) # Uses an action to add JDK 17 to the VM (and mvn?)
- name: set up JDK 17 - name: set up JDK 17
uses: actions/setup-java@v3 uses: actions/setup-java@v3
with: with:
distribution: 'temurin' distribution: 'temurin'
java-version: 17 java-version: 17
architecture: x64 architecture: x64
#Uses an action to set up a cache using a certain key based on the hash of the dependencies #Uses an action to set up a cache using a certain key based on the hash of the dependencies
- name: Cache Maven packages - name: Cache Maven packages
uses: actions/cache@v3.2.3 uses: actions/cache@v3.2.3
with: with:
path: ~/.m2 path: ~/.m2
key: ubuntu-latest-m2-${{ hashFiles('**/pom.xml') }} key: ubuntu-latest-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ubuntu-latest-m2- restore-keys: ubuntu-latest-m2-
- uses: BSFishy/pip-action@v1 - uses: BSFishy/pip-action@v1
with: with:
packages: | packages: |
robotframework robotframework
robotframework-SeleniumLibrary robotframework-SeleniumLibrary
webdriver-manager webdriver-manager
- name: Run with Maven - name: Run with Maven
run: mvn --no-transfer-progress spring-boot:run & run: mvn --no-transfer-progress spring-boot:run &
- name: Wait to start - name: Wait to start
uses: ifaxity/wait-on-action@v1 uses: ifaxity/wait-on-action@v1
with: with:
resource: http://127.0.0.1:8080/WebGoat resource: http://127.0.0.1:8080/WebGoat
- name: Test with Robotframework - name: Test with Robotframework
run: python3 -m robot --variable HEADLESS:"1" --outputdir robotreport robot/goat.robot run: python3 -m robot --variable HEADLESS:"1" --outputdir robotreport robot/goat.robot
# send report to forks only due to limits on permission tokens # send report to forks only due to limits on permission tokens
- name: Send report to commit - name: Send report to commit
if: github.repository != 'WebGoat/WebGoat' && github.event_name == 'push' if: github.repository != 'WebGoat/WebGoat' && github.event_name == 'push'
uses: joonvena/robotframework-reporter-action@v2.1 uses: joonvena/robotframework-reporter-action@v2.1
with: with:
gh_access_token: ${{ secrets.GITHUB_TOKEN }} gh_access_token: ${{ secrets.GITHUB_TOKEN }}
report_path: 'robotreport' report_path: 'robotreport'

View File

@ -86,7 +86,7 @@ For example: `Fix #545` or `Closes #10`
```bash ```bash
$ git fetch upstream $ git fetch upstream
$ git merge upstream/develop $ git merge upstream/main
``` ```
See also the following article for further explanation on "[How to Keep a Downstream git Repository Current with Upstream Repository Changes](https://medium.com/sweetmeat/how-to-keep-a-downstream-git-repository-current-with-upstream-repository-changes-10b76fad6d97 "How to Keep a Downstream git Repository Current with Upstream Repository Changes")". See also the following article for further explanation on "[How to Keep a Downstream git Repository Current with Upstream Repository Changes](https://medium.com/sweetmeat/how-to-keep-a-downstream-git-repository-current-with-upstream-repository-changes-10b76fad6d97 "How to Keep a Downstream git Repository Current with Upstream Repository Changes")".

View File

@ -2,31 +2,18 @@
### Version numbers ### Version numbers
For WebGoat we use milestone releases first before we release the official version, we use `v8.0.0.M3` while tagging For WebGoat we use milestone releases first before we release the official version, we use `v2023.01` while tagging
and 8.0.0.M3 in the `pom.xml`. When we create the final release we remove the milestone release and use and 2023.01 in the `pom.xml`.
`v8.0.0` in the `pom.xml`
### Release notes: ### Release notes:
Update the release notes with the correct version. Use `git shortlog -s -n --since "SEP 31 2019"` for the list of Update the release notes with the correct version. Use `git shortlog -s -n --since "JAN 06 2023"` for the list of
committers. committers.
At the moment we use Gitflow, for a release you create a new release branch and take the following steps:
``` ```
git checkout develop mvn versions:set
git flow release start <version> << update release notes >>
git flow release publish git commit ....
git tag v2023.01
<<Make changes if necessary>>
<<Update RELEASE_NOTES.md>>
git flow release finish <version>
git push origin develop
git push origin main
git push --tags git push --tags
``` ```
Now Travis takes over and will create the release in Github and on Docker Hub.
NOTE: the `mvn versions:set` command above is just there to make sure the master branch contains the latest version