Skip to content

Commit

Permalink
feat(ci): no more Travis, replaced by GitHub Actions with Semantic Re…
Browse files Browse the repository at this point in the history
…lease
  • Loading branch information
e-picas committed Jan 25, 2024
1 parent 5a34609 commit 62304ed
Show file tree
Hide file tree
Showing 6 changed files with 232 additions and 12 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/bump_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@

name: "Bump version"
run-name: "Bump a new version tag"

on:
push:
branches:
- master
- master-bootstrap-4
- master-bootstrap-5

permissions:
contents: read # for checkout

jobs:

bump_release:
name: "Bump version"
if: "!contains(github.event.head_commit.message, 'chore(release)')"
runs-on: ubuntu-latest
permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
id-token: write # to enable use of OIDC for npm provenance
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
token: ${{ secrets.PERSONAL_GITHUB_TOKEN }}

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "lts/*"

- name: Install dependencies
run: npm install -g semantic-release @semantic-release/github @semantic-release/git @semantic-release/changelog @semantic-release/exec @saithodev/semantic-release-backmerge

- name: Setup git
run: |
git config user.email "${{ env.GITHUB_TRIGGERING_ACTOR }}"
git config user.name "github-ci-bot"
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_GITHUB_TOKEN }}
run: npx semantic-release
54 changes: 54 additions & 0 deletions .github/workflows/make_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@

name: "Begin new release"
run-name: "Create a new release branch forking dev"

on:
workflow_dispatch:

permissions:
contents: read # for checkout

jobs:

begin_release:
name: "Begin next release"
if: ${{ (github.ref_name == 'dev' || contains(github.ref_name, 'dev-')) && github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
id-token: write # to enable use of OIDC for npm provenance
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
token: ${{ secrets.PERSONAL_GITHUB_TOKEN }}

- name: debug
run: printenv; git remote -v; git status;

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "lts/*"

- name: Install dependencies
run: npm install -g semantic-release @semantic-release/github @semantic-release/git @semantic-release/changelog @semantic-release/exec @saithodev/semantic-release-backmerge

- name: Setup git
run: |
git config user.email "${{ env.GITHUB_TRIGGERING_ACTOR }}"
git config user.name "github-ci-bot"
- name: Create the release branch
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_GITHUB_TOKEN }}
run: |
git pull
semantic-release --dry-run --no-ci
NEXT_VERSION=$(cat /tmp/next_release)
git checkout -b "release-${NEXT_VERSION}"
git push origin release-${NEXT_VERSION}
61 changes: 61 additions & 0 deletions .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@

name: "Publish release"
run-name: "Publish a release by merging it to master and deleting the release branch"

on:
workflow_dispatch:
inputs:
targetBranch:
description: 'Target branch'
required: true
default: 'master'
type: choice
options:
- master

permissions:
contents: read # for checkout

jobs:

bump_release:
name: "Publish release"
if: ${{ contains(github.ref_name, 'release-') && github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
id-token: write # to enable use of OIDC for npm provenance
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
token: ${{ secrets.PERSONAL_GITHUB_TOKEN }}

- name: Setup git
run: |
git config user.email "${{ env.GITHUB_TRIGGERING_ACTOR }}"
git config user.name "github-ci-bot"
- name: Merging release
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_GITHUB_TOKEN }}
run: |
git fetch
git rev-parse --verify ${{ inputs.targetBranch }} && git branch -D ${{ inputs.targetBranch }}
git checkout --force --track origin/${{ inputs.targetBranch }}
git reset --hard origin/${{ inputs.targetBranch }}
git merge --no-ff --no-edit --no-commit origin/${{ github.ref_name }}
NEED_COMMIT=$(git diff --name-status --cached --exit-code 1>/dev/null; echo $?;)
if [[ $NEED_COMMIT == 1 ]]
then
git commit -m "ci(${{ github.ref_name }}): merging prepared release"
git push origin ${{ inputs.targetBranch }}
else
echo "> no changes to be commited on ${{ inputs.targetBranch }}"
echo "> no new release to bump"
fi
# delete release branch
git push --delete origin ${{ github.ref_name }}
39 changes: 39 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

name: "Run tests"
run-name: "Run Unit tests & cs-fixer for validation"

on:
push:

permissions:
contents: read # for checkout

jobs:

bump_release:
name: "PHP unit tests & code standards"
runs-on: ubuntu-latest
permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
id-token: write # to enable use of OIDC for npm provenance
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
token: ${{ secrets.PERSONAL_GITHUB_TOKEN }}

- name: Install composer dependencies
uses: php-actions/composer@v6

- name: Run CS-Fixer
uses: php-actions/composer@v6
with:
command: run cs-fixer-ci

- name: Run unit tests
uses: php-actions/composer@v6
with:
command: run test
29 changes: 29 additions & 0 deletions .releaserc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

branches:
- "+([0-9])?(.{+([0-9]),x}).x"
- name: "master"
- name: "dev"
- name: "release-*"
prerelease: "alpha"

plugins:
- path: "@semantic-release/commit-analyzer"
- path: "@semantic-release/release-notes-generator"
commit: "/commit"
- path: "@semantic-release/github"
- path: "@semantic-release/changelog"
changelogFile: "CHANGELOG.md"
changelogTitle: "# Markdown Extended changelog"
- path: "@semantic-release/git"
assets:
- "CHANGELOG.md"
message: |
chore(release): ${nextRelease.version}
${nextRelease.notes}
- path: "@semantic-release/exec"
verifyReleaseCmd: "echo \"${nextRelease.version}\" > /tmp/next_release"
- path: "@saithodev/semantic-release-backmerge"
backmergeBranches:
- from: "master"
to: "dev"
12 changes: 0 additions & 12 deletions .travis.yml

This file was deleted.

0 comments on commit 62304ed

Please sign in to comment.