Merge pull request #42 from bhklab:development #155
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI-CD | |
# This code is a basic example of a CI/CD pipeline that uses Pixi and Semantic Release to automate the release process. | |
on: | |
push: | |
branches: [ '*' ] | |
pull_request: | |
branches: [ 'main' , 'staging'] | |
jobs: | |
Run-A-Pixi-Job: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Run A Pixi Job | |
run: echo "Running a Pixi Job" | |
- name: Setup Pixi | |
uses: prefix-dev/[email protected] | |
with: | |
pixi-version: v0.19.0 | |
log-level: vv | |
manifest-path: pyproject.toml | |
- name: Run Pixi | |
run: | | |
pixi run python --version | |
pixi run test | |
Semantic-Release: | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && (github.ref == 'refs/heads/main') | |
needs: Run-A-Pixi-Job | |
concurrency: release | |
permissions: | |
id-token: write | |
contents: write | |
packages: write | |
actions: read | |
steps: | |
- uses: actions/create-github-app-token@v1 | |
id: app-token | |
with: | |
app-id: ${{ vars.SEMVERPOLICE_ID }} | |
private-key: ${{ secrets.SEMVER_APP_KEY }} | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ steps.app-token.outputs.token }} | |
- name: Python Semantic Release | |
uses: python-semantic-release/python-semantic-release@master | |
with: | |
root_options: -v | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
git_committer_name: 'gh-actions-semver' | |
Update-Branches: | |
runs-on: ubuntu-latest | |
needs: Semantic-Release | |
if: needs.Semantic-Release.outputs.released == 'true' && github.event_name == 'push' && (github.ref == 'refs/heads/main') | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Configure Git | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub Actions" | |
- name: Merge and push to staging | |
run: | | |
git checkout staging | |
git merge --no-ff main -m "Merge main into staging [ci skip]" | |
git push origin staging | |
- name: Merge and push to development | |
run: | | |
git checkout development | |
git merge --no-ff main -m "Merge main into development [ci skip]" | |
git push origin development |