Skip to content

Bump version from 0.0.3 to 0.0.4 #12

Bump version from 0.0.3 to 0.0.4

Bump version from 0.0.3 to 0.0.4 #12

Workflow file for this run

---
name: CD
on:
push:
branches:
- main
paths:
- "src/**"
workflow_dispatch:
jobs:
version-type:
uses: ./.github/workflows/_version_type.yml
version-bump:
name: Version bump
runs-on: ubuntu-22.04
needs: version-type
outputs:
version: ${{ steps.get-version.outputs.version }}
steps:
- name: Login to Azure - CI Subscription
uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0
with:
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
- name: Retrieve secrets
id: retrieve-secrets
uses: bitwarden/gh-actions/get-keyvault-secrets@main
with:
keyvault: "bitwarden-ci"
secrets: "github-gpg-private-key,
github-gpg-private-key-passphrase,
github-pat-bitwarden-devops-bot-repo-scope"
- name: Check out repo
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 0
token: ${{ steps.retrieve-secrets.outputs.github-pat-bitwarden-devops-bot-repo-scope }}
- name: Set up Python
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
with:
python-version-file: ".python-version"
- name: Install hatch
run: pip install hatch
- name: Get current version
run: echo "OLD_VERSION=$(hatch version)" >> $GITHUB_ENV
- name: Bump version
run: hatch version ${{ needs.version-type.outputs.version_bump_type }}
- name: Get bumped version
id: get-version
run: |
VERSION=$(hatch version)
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 # v6.1.0
with:
gpg_private_key: ${{ steps.retrieve-secrets.outputs.github-gpg-private-key }}
passphrase: ${{ steps.retrieve-secrets.outputs.github-gpg-private-key-passphrase }}
git_user_signingkey: true
git_commit_gpgsign: true
- name: Setup git
run: |
git config --local user.email "[email protected]"
git config --local user.name "bitwarden-devops-bot"
- name: Commit version bump
env:
OLD_VERSION: ${{ env.OLD_VERSION }}
VERSION: ${{ steps.get-version.outputs.version }}
run: |
git commit -am "Bump version from $OLD_VERSION to $VERSION"
git tag v$VERSION
git push
git push --tags
release:
name: GitHub release
runs-on: ubuntu-22.04
needs: version-bump
steps:
- name: Check out repo
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Create GitHub release
uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0
with:
commit: ${{ github.sha }}
tag: v${{ steps.get-version.outputs.version }}
name: v${{ steps.get-version.outputs.version }}
token: ${{ secrets.GITHUB_TOKEN }}
draft: false
deploy:
name: Deploy workflow-linter (v2)
runs-on: ubuntu-22.04
needs: version-bump
steps:
- name: Check out repo
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Set up Python
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
with:
python-version-file: ".python-version"
- name: Install hatch
run: pip install hatch
- name: Login to Azure - CI Subscription
uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0
with:
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
- name: Retrieve pypi api token
id: retrieve-secret
uses: bitwarden/gh-actions/get-keyvault-secrets@main
with:
keyvault: "bitwarden-ci"
secrets: "pypi-api-token"
- name: Build
run: hatch build
- name: Publish
env:
HATCH_INDEX_USER: __token__
HATCH_INDEX_AUTH: ${{ steps.retrieve-secret.outputs.pypi-api-token }}
run: hatch publish