name: Release
on:
pull_request:
branches:
- "main"
types: [closed]
permissions:
contents: write
jobs:
release-crates-io:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Get bump method
id: get-bump-method
run: |
echo ${{ github.event.pull_request.labels.*.name }}
if ${{ contains(github.event.pull_request.labels.*.name, 'B-candidate') }}; then
echo '::set-output name=BUMP::rc'
elif ${{ contains(github.event.pull_request.labels.*.name, 'B-patch') }}; then
echo '::set-output name=BUMP::patch'
elif ${{ contains(github.event.pull_request.labels.*.name, 'B-minor') }}; then
echo '::set-output name=BUMP::minor'
elif ${{ contains(github.event.pull_request.labels.*.name, 'B-major') }}; then
echo '::set-output name=BUMP::major'
else
exit 1
fi
- run: echo ${{ steps.get-bump-method.outputs.BUMP }}
- uses: actions/checkout@v3
with:
token: ${{ secrets.PAT }}
fetch-depth: 0
- uses: mstachniuk/ci-skip@v1
with:
fail-fast: true
commit-filter: "(cargo-release)"
- uses: actions/cache@v1
with:
path: |
~/.cargo/bin
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db/
./target
key: "${{ runner.os }}-cargo-build-stable-${{ hashFiles('**/Cargo.lock') }}"
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- run: cargo install cargo-release
- run: cargo login ${{ secrets.CARGO_REGISTRY_TOKEN }}
- run: |
git config --global user.name 'Mathieu LALA [bot]'
git config --global user.email 'mathieu.lala@epitech.eu'
- run: cargo release ${{ steps.get-bump-method.outputs.BUMP }} --workspace --execute --no-confirm