Skip to content

Commit

Permalink
Merge pull request #3203 from mercedes-benz/feature-3202-initial
Browse files Browse the repository at this point in the history
initial workflow as basis for development #3202
  • Loading branch information
sven-dmlr authored Jun 10, 2024
2 parents d6ff374 + 88c6131 commit 91e3fd7
Showing 1 changed file with 163 additions and 0 deletions.
163 changes: 163 additions & 0 deletions .github/workflows/release-github-action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
# SPDX-License-Identifier: MIT
name: Release Github Action

on:
workflow_dispatch:
inputs:
actor-email:
description: Insert your email address here. It will be used in the generated pull requests
required: true
ghaction-version:
description: Github Action Version (e.g. 1.0.0)
required: true
ghaction-milestone-number:
description: Github Action Milestone number (e.g. 70)
required: true

permissions:
contents: write
issues: write
pull-requests: write

jobs:
release-version:
name: Create Github Action release
runs-on: ubuntu-latest
steps:

- name: "Show Inputs"
run: |
echo "actor-email: '${{ inputs.actor-email }}'"
echo "Github Action '${{ inputs.ghaction-version }}' - Milestone '${{ inputs.ghaction-milestone-number }}'"
# Check inputs:
- name: "Verify Input for Github Action release"
if: (inputs.ghaction-version == '') || (inputs.ghaction-milestone-number == '')
run: |
echo "For Github Action release, ghaction-version and ghaction-milestone-number must be provided!"
exit 1
# - name: Checkout master
# uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
# with:
# ref: master

# # Create temporary local tag, so we build for this tag...
# # The final tag on git server side will be done automatically by the release when the draft is saved as "real" release
# - name: "Temporary tag server version: v${{ inputs.ghaction-version }}-ghaction"
# run: git tag v${{ inputs.ghaction-version }}-ghaction

# # ----------------------
# # Setup + Caching
# # ----------------------
# # - name: Set up JDK 17
# # uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9
# # with:
# # java-version: 17
# # distribution: temurin

# # ----------------------
# # Create pull request if license headers are missing
# # ----------------------
# - name: run apply-headers.sh
# id: apply-headers
# run: |
# git config user.name "$GITHUB_TRIGGERING_ACTOR (via github-actions)"
# git config user.email "${{ inputs.actor-email }}"
# ./apply-headers.sh
# git commit -am "SPDX headers added by SecHub release job @github-actions" || true
# COMMITS=`git log --oneline --branches --not --remotes`
# echo "commits=$COMMITS" >> $GITHUB_OUTPUT

# - name: Create pull request for SPDX license headers
# id: pr_spdx_headers
# if: steps.apply-headers.outputs.commits != ''
# uses: peter-evans/create-pull-request@6d6857d36972b65feb161a90e484f2984215f83e
# with:
# branch: release-spdx-headers
# branch-suffix: short-commit-hash
# delete-branch: true
# title: '0 - Before ghaction release: Add missing SPDX license headers [auto-generated]'
# body: |
# Auto-generated by Github Actions ghaction release job.

# -> Please review and merge **before** publishing the ghaction release.

# - name: Print PR infos
# if: steps.apply-headers.outputs.commits != ''
# run: |
# echo "Pull Request Number - ${{ steps.pr_spdx_headers.outputs.pull-request-number }}"
# echo "Pull Request URL - ${{ steps.pr_spdx_headers.outputs.pull-request-url }}"

# # ----------------------
# # Build SecHub Github Action
# # ----------------------
# # - name: Build Github Action jar files
# # run: ./gradlew ensureLocalhostCertificate :sechub-api-java:build :sechub-ghaction:build -Dsechub.build.stage=api-necessary --console=plain

# # ----------------------
# # Create pull request for updated files
# # ----------------------

# - name: Create Github Action release
# id: create_ghaction_release
# uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
# with:
# tag_name: v${{ inputs.ghaction-version }}-gha
# commitish: master
# release_name: Github Action Version ${{ inputs.ghaction-version }}
# body: |
# Changes in this Release
# - Some minor changes on Github Action implementation

# For more details please look at [Milestone ${{inputs.ghaction-milestone-number}}]( https://github.com/mercedes-benz/sechub/milestone/${{inputs.ghaction-milestone-number}}?closed=1)
# draft: true
# prerelease: false

# # -----------------------------------------
# # Create release issue
# # -----------------------------------------
# - name: Create SecHub Github Action ${{ inputs.ghaction-version }} release issue
# uses: dacbd/create-issue-action@main
# with:
# token: ${{ github.token }}
# title: Release SecHub Github Action ${{ inputs.ghaction-version }}
# body: |
# See [Milestone ${{inputs.ghaction-milestone-number}}]( https://github.com/mercedes-benz/sechub/milestone/${{inputs.ghaction-milestone-number}}?closed=1) for details.

# Please close this issue after the release.
# milestone: ${{ inputs.ghaction-milestone-number }}

# # -----------------------------------------
# # Create a pull request for merging back `master` into `develop`
# # -----------------------------------------
# - name: pull-request master to develop
# id: pr_master_to_develop
# continue-on-error: true
# uses: repo-sync/pull-request@7e79a9f5dc3ad0ce53138f01df2fad14a04831c5
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# source_branch: "master"
# destination_branch: "develop"
# pr_allow_empty: true # should allow an empty PR, but seems not to work
# pr_title: '2 - After ghaction release: Merge master back into develop [auto-generated]'
# pr_body: |
# After SecHub Github Action release
# - Github Action '${{ inputs.ghaction-version }}'

# Merge master branch back into develop

# -> Please merge **after** the release has been published.

# - name: Print PR infos if PR was created
# if: steps.pr_master_to_develop.outcome == 'success'
# run: |
# echo "Pull Request Number - ${{ steps.pr_master_to_develop.outputs.pr_number }}"
# echo "Pull Request URL - ${{ steps.pr_master_to_develop.outputs.pr_url }}"

# - name: Print info if no PR was created
# if: steps.pr_master_to_develop.outcome != 'success'
# run: |
# echo "Nothing to merge - no pull request necessary."

0 comments on commit 91e3fd7

Please sign in to comment.