Skip to content

Commit

Permalink
ci: update layout and ci dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
kilianpaquier committed May 8, 2024
1 parent 848317b commit 84cd4cb
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 31 deletions.
4 changes: 4 additions & 0 deletions .craft
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
---
ci:
name: github
release:
auto: false
backmerge: false
mode: github-token
options:
- codecov
- codeql
Expand Down
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ updates:
- patch
commit-message:
include: scope
prefix: ci
prefix: chore
reviewers:
- kilianpaquier
10 changes: 10 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ on:
push:
branches:
- main
- master
- staging
- dev
- develop
- development
- next
- beta
- alpha
- v[0-9]+.x
- v[0-9]+.[0-9]+.x

jobs:
codeql:
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ on:
push:
branches:
- main
- master
- staging
- dev
- develop
- development
- next
- beta
- alpha
- v[0-9]+.x
- v[0-9]+.[0-9]+.x

permissions:
contents: write
Expand Down
18 changes: 10 additions & 8 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,17 @@ on:
- ready_for_review
push:
branches:
- alpha
- beta
- develop
- main
- next
- master
- staging
# unnecessary to espace '.'
# see https://docs.github.com/fr/actions/using-workflows/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet
- v[0-9]+(.[0-9]+)?
- dev
- develop
- development
- next
- beta
- alpha
- v[0-9]+.x
- v[0-9]+.[0-9]+.x
workflow_dispatch:

jobs:
Expand Down Expand Up @@ -61,7 +63,7 @@ jobs:
go-version-file: go.mod
token: ${{ secrets.GITHUB_TOKEN }}
- run: mkdir -p reports/
- uses: golangci/golangci-lint-action@v5
- uses: golangci/golangci-lint-action@v6
with:
args: --config .golangci.yml --timeout 240s --fast --sort-results --out-format checkstyle:reports/go-ci-lint.checkstyle.xml,colored-line-number

Expand Down
49 changes: 27 additions & 22 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ jobs:
pull-requests: write
steps:
- uses: actions/checkout@v4
- id: sha
run: echo "sha=$(echo "$GITHUB_REF_NAME" | sha256sum | cut -c -8)" >> $GITHUB_OUTPUT
# https://github.com/marketplace/actions/action-for-semantic-release
- id: semantic_release
continue-on-error: true
Expand All @@ -47,33 +45,38 @@ jobs:
branches: |
[
"(master|main)",
"v+([0-9])?(.+([0-9]))",
"v+([0-9])?(.{+([0-9]),x}).x",
{ "name": "next", "prerelease": true },
{ "name": "beta", "prerelease": true },
{ "name": "alpha", "prerelease": true },
{ "name": "staging", "prerelease": "beta" },
{ "name": "develop", "prerelease": "alpha" }
{ "name": "(dev|develop|development)", "prerelease": "alpha" }
]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- id: release
run: |
if [ "$RELEASED" = "true" ]; then
echo "version=v$NEW_VERSION" >> $GITHUB_OUTPUT
elif [ "$LAST_VERSION" != "" ]; then
echo "version=v${LAST_VERSION}-${BRANCH_SHA}" >> $GITHUB_OUTPUT
else
echo "version=v0.0.0-dev.${BRANCH_SHA}" >> $GITHUB_OUTPUT
fi
SHA=$(echo "${GITHUB_REF_NAME}" | sha256sum | cut -c -8)
if [[ $NEW_VERSION =~ ^[0-9]+(\.[0-9]+){2}$ ]]; then
echo "release=true" >> $GITHUB_OUTPUT
if echo "$SEMREL_INFO_NEXT_VERSION" | grep -Eq "^[0-9]+(\.[0-9]+){2}.*$"; then
echo "version=v$SEMREL_INFO_NEXT_VERSION" >> $GITHUB_OUTPUT
echo "$SEMREL_INFO_NEXT_VERSION" | grep -Eq "^[0-9]+(\.[0-9]+){2}$" && echo "release=true" >> $GITHUB_OUTPUT
exit 0
fi
git fetch --tags
SEARCH="" # see .gitlab/version.yml.tmpl - may evolve in the future
SEMREL_INFO_LAST_VERSION=$(git tag --list | sort -V | grep -E "${SEARCH}" | tail -n1)
SEMREL_INFO_NEXT_VERSION=${SEMREL_INFO_LAST_VERSION-1.0.0}
SEMREL_INFO_NEXT_VERSION=${SEMREL_INFO_NEXT_VERSION%-*}
echo "version=v${SEMREL_INFO_NEXT_VERSION#v}-build.${SHA}" >> $GITHUB_OUTPUT
env:
BRANCH_SHA: ${{ steps.sha.outputs.sha }}
LAST_VERSION: ${{ steps.semantic_release.outputs.last_release_version }}
NEW_VERSION: ${{ steps.semantic_release.outputs.new_release_version }}
RELEASED: ${{ steps.semantic_release.outputs.new_release_published }}
SEMREL_INFO_LAST_VERSION: ${{ steps.semantic_release.outputs.last_release_version }}
SEMREL_INFO_NEXT_VERSION: ${{ steps.semantic_release.outputs.new_release_version }}
- run: echo $VERSION
env:
VERSION: ${{ steps.release.outputs.version }}
Expand All @@ -83,10 +86,12 @@ jobs:
runs-on: ubuntu-latest
if: github.ref_protected == true
environment: release
permissions:
contents: write
issues: write
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
# https://github.com/marketplace/actions/action-for-semantic-release
- id: semantic-release
uses: cycjimmy/semantic-release-action@v4
Expand All @@ -106,12 +111,12 @@ jobs:
branches: |
[
"(master|main)",
"v+([0-9])?(.+([0-9]))",
"v+([0-9])?(.{+([0-9]),x}).x",
{ "name": "next", "prerelease": true },
{ "name": "beta", "prerelease": true },
{ "name": "alpha", "prerelease": true },
{ "name": "staging", "prerelease": "beta" },
{ "name": "develop", "prerelease": "alpha" }
{ "name": "(dev|develop|development)", "prerelease": "alpha" }
]
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 84cd4cb

Please sign in to comment.