Skip to content

Commit

Permalink
INIT
Browse files Browse the repository at this point in the history
  • Loading branch information
kayman-mk committed May 8, 2024
1 parent 2ec3c2f commit e8734f1
Show file tree
Hide file tree
Showing 16 changed files with 282 additions and 48 deletions.
18 changes: 5 additions & 13 deletions .github/workflows/default_release_callable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,14 @@ jobs:
with:
fetch-depth: 0

- name: Checkout release setup
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.4
with:
repository: Hapag-Lloyd/Workflow-Templates
path: .release_clone
ref: stable

- name: Setup release
run: |
ls -la *
ls -la .release_clone/
pwd
# using stable here to be able to quickly switch to a working version in case the current stable is broken
git clone --no-tags --branch stable --single-branch https://github.com/Hapag-Lloyd/Workflow-Templates.git .release_clone
mv .release_clone/.release_github_only_auto .release
mv .release/.releaserec.yml .releaserec.yml
ls -la .release/
mv .release/.releaserc.yml .releaserc.yml
- name: Setup Node.js
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/default_release_dry_run_callable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ jobs:
with:
ref: release-dry-run

- name: Setup release
run: |
pwd
# using stable here to be able to quickly switch to a working version in case the current stable is broken
git clone --no-tags --branch stable --single-branch https://github.com/Hapag-Lloyd/Workflow-Templates.git .release_clone
mv .release_clone/.release_github_only_auto .release
mv .release/.releaserc.yml .releaserc.yml
- name: Setup Node.js
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/maven_release_callable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ jobs:
with:
fetch-depth: 0

- name: Setup release
run: |
pwd
# using stable here to be able to quickly switch to a working version in case the current stable is broken
git clone --no-tags --branch stable --single-branch https://github.com/Hapag-Lloyd/Workflow-Templates.git .release_clone
mv .release_clone/.release_maven_auto .release
mv .release/.releaserc.yml .releaserc.yml
- name: Set up JDK 21
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
with:
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/maven_release_dry_run_callable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ jobs:
with:
ref: release-dry-run

- name: Setup release
run: |
pwd
# using stable here to be able to quickly switch to a working version in case the current stable is broken
git clone --no-tags --branch stable --single-branch https://github.com/Hapag-Lloyd/Workflow-Templates.git .release_clone
mv .release_clone/.release_maven_auto .release
mv .release/.releaserc.yml .releaserc.yml
- name: Set up JDK 21
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
with:
Expand Down
21 changes: 2 additions & 19 deletions .github/workflows/this_linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,6 @@ on:

jobs:
default:
uses: Hapag-Lloyd/Repository-Templates/.github/workflows/default_linter_callable.yml@6cebb62b60151c78910271dc54c22e0046d2f23e
# using stable to be able to quickly switch to a working version in case the current stable is broken
uses: Hapag-Lloyd/Repository-Templates/.github/workflows/default_linter_callable.yml@stable
secrets: inherit

test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.4
with:
fetch-depth: 0

- name: Setup release
run: |
pwd
git clone --no-tags --branch stable --single-branch https://github.com/Hapag-Lloyd/Workflow-Templates.git .release_clone
mv .release_clone/.release_github_only_auto .release
mv .release/.releaserc.yml .releaserc.yml
ls -la .release/
4 changes: 2 additions & 2 deletions .github/workflows/this_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ on:

jobs:
default:
# yamllint disable-line rule:line-length
uses: Hapag-Lloyd/Repository-Templates/.github/workflows/default_pull_request_callable.yml@6cebb62b60151c78910271dc54c22e0046d2f23e
# using stable to be able to quickly switch to a working version in case the current stable is broken
uses: Hapag-Lloyd/Repository-Templates/.github/workflows/default_pull_request_callable.yml@stable
secrets: inherit
3 changes: 2 additions & 1 deletion .github/workflows/this_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ on:

jobs:
default:
uses: Hapag-Lloyd/Repository-Templates/.github/workflows/github_release_callable.yml@6cebb62b60151c78910271dc54c22e0046d2f23e
# using stable to be able to quickly switch to a working version in case the current stable is broken
uses: Hapag-Lloyd/Repository-Templates/.github/workflows/github_release_callable.yml@stable
secrets: inherit
4 changes: 2 additions & 2 deletions .github/workflows/this_release_dry_run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ on:

jobs:
default:
# yamllint disable-line rule:line-length
uses: Hapag-Lloyd/Repository-Templates/.github/workflows/github_release_dry_run_callable.yml@6cebb62b60151c78910271dc54c22e0046d2f23e
# using stable to be able to quickly switch to a working version in case the current stable is broken
uses: Hapag-Lloyd/Repository-Templates/.github/workflows/github_release_dry_run_callable.yml@stable
secrets: inherit
4 changes: 2 additions & 2 deletions .github/workflows/this_renovate_auto_approve.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ on: pull_request_target

jobs:
default:
# yamllint disable-line rule:line-length
uses: Hapag-Lloyd/Repository-Templates/.github/workflows/default_renovate_auto_approve_callable.yml@6cebb62b60151c78910271dc54c22e0046d2f23e
# using stable to be able to quickly switch to a working version in case the current stable is broken
uses: Hapag-Lloyd/Repository-Templates/.github/workflows/default_renovate_auto_approve_callable.yml@stable
secrets: inherit
4 changes: 2 additions & 2 deletions .github/workflows/this_slash_ops_command_help.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ on:

jobs:
default:
# yamllint disable-line rule:line-length
uses: Hapag-Lloyd/Repository-Templates/.github/workflows/default_slash_ops_command_help_callable.yml@6cebb62b60151c78910271dc54c22e0046d2f23e
# using stable to be able to quickly switch to a working version in case the current stable is broken
uses: Hapag-Lloyd/Repository-Templates/.github/workflows/default_slash_ops_command_help_callable.yml@stable
secrets: inherit
4 changes: 2 additions & 2 deletions .github/workflows/this_slash_ops_comment_dispatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ on:

jobs:
default:
# yamllint disable-line rule:line-length
uses: Hapag-Lloyd/Repository-Templates/.github/workflows/default_slash_ops_comment_dispatch_callable.yml@6cebb62b60151c78910271dc54c22e0046d2f23e
# using stable to be able to quickly switch to a working version in case the current stable is broken
uses: Hapag-Lloyd/Repository-Templates/.github/workflows/default_slash_ops_comment_dispatch_callable.yml@stable
secrets: inherit
3 changes: 2 additions & 1 deletion .github/workflows/this_spelling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ on:

jobs:
default:
uses: Hapag-Lloyd/Repository-Templates/.github/workflows/default_spelling_callable.yml@6cebb62b60151c78910271dc54c22e0046d2f23e
# using stable to be able to quickly switch to a working version in case the current stable is broken
uses: Hapag-Lloyd/Repository-Templates/.github/workflows/default_spelling_callable.yml@stable
secrets: inherit
3 changes: 2 additions & 1 deletion .github/workflows/this_stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ on:

jobs:
default:
uses: Hapag-Lloyd/Repository-Templates/.github/workflows/default_stale_callable.yml@6cebb62b60151c78910271dc54c22e0046d2f23e
# using stable to be able to quickly switch to a working version in case the current stable is broken
uses: Hapag-Lloyd/Repository-Templates/.github/workflows/default_stale_callable.yml@stable
secrets: inherit
4 changes: 2 additions & 2 deletions .github/workflows/this_welcome_message.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ on:

jobs:
default:
# yamllint disable-line rule:line-length
uses: Hapag-Lloyd/Repository-Templates/.github/workflows/default_welcome_message_callable.yml@6cebb62b60151c78910271dc54c22e0046d2f23e
# using stable to be able to quickly switch to a working version in case the current stable is broken
uses: Hapag-Lloyd/Repository-Templates/.github/workflows/default_welcome_message_callable.yml@stable
secrets: inherit
52 changes: 51 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,52 @@
# Workflow-Templates
Template files for workflows

This repository stores templates used to set up workflows for new repositories.

## Set up a new repository

Clone this repository to your disk and run `setup-workflows.sh`. It copies the necessary files to the correct
locations in your new repository.

```bash
./setup-workflows.sh <path-to-new-repository> <type>
```

Search for `TODO` in the copied files and replace the placeholders with the correct values. The same script can be used to update
all files in case of major changes in the templates.

:warning: Make sure to run the script from the latest `main` branch to get the most recent templates.

## What you get

### Default setup

- Release management is done with [semantic-release](https://github.com/semantic-release/semantic-release). Releases are automatically tagged and published on GitHub. Special
releases for Maven Central and Terraform modules are supported.
- stale issue and PR management
- welcome message for contributors
- linters for all files
- PRs are checked for semantic commit titles to ensure an automatic release
- ChatOps to run workflows from comments

## For Developers - Repository Layout

1. Add all workflows to `.github/workflows/`, otherwise they can't be referenced from the repositories.
2. Workflows with `this_` prefix are used for this repository only.
3. Workflows with `default_` prefix are added to every new repository. Otherwise use the correct prefix for the project type.

The script to set up the workflows for new repositories is `setup-workflows.sh`. It copies the necessary files to the new
repository. It starts with the default workflows and adds the specific ones based on the project type. In case of a filename clash,
the specific template overwrites the default one (exception: `.gitignore` These files are concatenated).

Use

```bash
# USE_REPOSITORY
# push:
# branches:
# - main
# /USE_REPOSITORY
```

in the file to describe the triggers which should be used in the repository. The script will automatically replace the triggers
marked with `USE_WORKFLOW` which are valid within this repository only.
Loading

0 comments on commit e8734f1

Please sign in to comment.