diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1d4081804..b58c1f4d9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,8 +8,6 @@ on: push: branches: - main - - develop - - release/* tags-ignore: - '*' paths-ignore: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ca83dfd2a..3e5686b8e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,10 +13,6 @@ jobs: steps: - uses: actions/checkout@v3 - - name: "Get tag name" - id: tag - uses: dawidd6/action-get-tag@v1 - - name: Set up JDK 17 uses: actions/setup-java@v3 with: @@ -33,8 +29,8 @@ jobs: - name: "Set labels for ${{ github.ref }}" run: | - echo "WEBGOAT_TAG_VERSION=${{ steps.tag.outputs.tag }}" >> $GITHUB_ENV - WEBGOAT_MAVEN_VERSION=${{ steps.tag.outputs.tag }} + echo "WEBGOAT_TAG_VERSION=${{ github.ref_name }}" >> $GITHUB_ENV + WEBGOAT_MAVEN_VERSION=${{ github.ref_name }} echo "WEBGOAT_MAVEN_VERSION=${WEBGOAT_MAVEN_VERSION:1}" >> $GITHUB_ENV - name: Build with Maven run: | @@ -94,7 +90,7 @@ jobs: with: context: ./ file: ./Dockerfile - push: true + push: true platforms: linux/amd64, linux/arm64, linux/arm/v7 tags: | webgoat/webgoat:${{ env.WEBGOAT_TAG_VERSION }} @@ -105,19 +101,14 @@ jobs: - name: "Image digest" run: echo ${{ steps.docker_build.outputs.digest }} new_version: - permissions: - contents: write # for Git to git push if: github.repository == 'WebGoat/WebGoat' - name: Update development version + name: Update to next SNAPSHOT version needs: [ release ] runs-on: ubuntu-latest - environment: - name: release steps: - uses: actions/checkout@v3 with: - ref: develop - token: ${{ secrets.WEBGOAT_DEPLOYER_TOKEN }} + fetch-depth: 0 - name: Set up JDK 17 uses: actions/setup-java@v3 @@ -129,10 +120,18 @@ jobs: run: | mvn build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion}-SNAPSHOT versions:commit - - name: Commit pom.xml - run: | - git config user.name webgoat-github - git config user.email owasp.webgoat@gmail.com - find . -name 'pom.xml' | xargs git add - git commit -m "Updating to the new development version" - git push + - name: Push the changes to new branch + uses: devops-infra/action-commit-push@v0.9.2 + with: + github_token: "${{ secrets.GITHUB_TOKEN }}" + add_timestamp: true + commit_message: "Updating to the new development version" + 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 + diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bea73c6f3..00221ab92 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,14 +2,11 @@ name: "UI-Test" on: pull_request: paths-ignore: - - '.txt' - - '*.MD' - - '*.md' - 'LICENSE' - 'docs/**' push: -# tags-ignore: -# - '*' + tags-ignore: + - 'v*' paths-ignore: - '.txt' - '*.MD' @@ -24,45 +21,45 @@ jobs: name: "Robot framework test" steps: # 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 - - name: Setup Pyton - uses: actions/setup-python@v4 - with: - python-version: '3.7' - architecture: x64 + - name: Setup Pyton + uses: actions/setup-python@v4 + with: + python-version: '3.7' + architecture: x64 # Uses an action to add JDK 17 to the VM (and mvn?) - - name: set up JDK 17 - uses: actions/setup-java@v3 - with: - distribution: 'temurin' - java-version: 17 - architecture: x64 + - name: set up JDK 17 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: 17 + architecture: x64 #Uses an action to set up a cache using a certain key based on the hash of the dependencies - - name: Cache Maven packages - uses: actions/cache@v3.2.3 - with: - path: ~/.m2 - key: ubuntu-latest-m2-${{ hashFiles('**/pom.xml') }} - restore-keys: ubuntu-latest-m2- - - uses: BSFishy/pip-action@v1 - with: - packages: | - robotframework - robotframework-SeleniumLibrary - webdriver-manager - - name: Run with Maven - run: mvn --no-transfer-progress spring-boot:run & - - name: Wait to start - uses: ifaxity/wait-on-action@v1 - with: - resource: http://127.0.0.1:8080/WebGoat - - name: Test with Robotframework - run: python3 -m robot --variable HEADLESS:"1" --outputdir robotreport robot/goat.robot + - name: Cache Maven packages + uses: actions/cache@v3.2.3 + with: + path: ~/.m2 + key: ubuntu-latest-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ubuntu-latest-m2- + - uses: BSFishy/pip-action@v1 + with: + packages: | + robotframework + robotframework-SeleniumLibrary + webdriver-manager + - name: Run with Maven + run: mvn --no-transfer-progress spring-boot:run & + - name: Wait to start + uses: ifaxity/wait-on-action@v1 + with: + resource: http://127.0.0.1:8080/WebGoat + - name: Test with Robotframework + run: python3 -m robot --variable HEADLESS:"1" --outputdir robotreport robot/goat.robot # send report to forks only due to limits on permission tokens - - name: Send report to commit - if: github.repository != 'WebGoat/WebGoat' && github.event_name == 'push' - uses: joonvena/robotframework-reporter-action@v2.1 - with: - gh_access_token: ${{ secrets.GITHUB_TOKEN }} - report_path: 'robotreport' + - name: Send report to commit + if: github.repository != 'WebGoat/WebGoat' && github.event_name == 'push' + uses: joonvena/robotframework-reporter-action@v2.1 + with: + gh_access_token: ${{ secrets.GITHUB_TOKEN }} + report_path: 'robotreport' diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a6f530e5f..4a97e18ee 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -86,7 +86,7 @@ For example: `Fix #545` or `Closes #10` ```bash $ 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")". diff --git a/CREATE_RELEASE.md b/CREATE_RELEASE.md index 1c37fd033..9a7531d74 100644 --- a/CREATE_RELEASE.md +++ b/CREATE_RELEASE.md @@ -2,31 +2,18 @@ ### Version numbers -For WebGoat we use milestone releases first before we release the official version, we use `v8.0.0.M3` while tagging -and 8.0.0.M3 in the `pom.xml`. When we create the final release we remove the milestone release and use -`v8.0.0` in the `pom.xml` +For WebGoat we use milestone releases first before we release the official version, we use `v2023.01` while tagging +and 2023.01 in the `pom.xml`. ### 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. -At the moment we use Gitflow, for a release you create a new release branch and take the following steps: - ``` -git checkout develop -git flow release start -git flow release publish - -<> -<> - -git flow release finish -git push origin develop -git push origin main +mvn versions:set +<< update release notes >> +git commit .... +git tag v2023.01 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