chore: added flake into the project (#19) #29
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: Release | |
on: | |
push: | |
branches: | |
- main | |
env: | |
GIT_USER_EMAIL: ${{ secrets.GIT_EMAIL }} | |
GIT_USER_NAME: ${{ secrets.GIT_NAME }} | |
GOPRIVATE: github.com/Drafteame | |
permissions: | |
contents: write | |
jobs: | |
bump_version: | |
if: "!startsWith(github.event.head_commit.message, 'bump:')" | |
runs-on: ubuntu-latest | |
name: "Bump version" | |
steps: | |
- name: Check out | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: "${{ secrets.ACCESS_TOKEN }}" | |
ref: "main" | |
- name: Install Nix | |
uses: cachix/install-nix-action@v25 | |
with: | |
nix_path: nixpkgs=channel:nixos-unstable | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
- name: Config Git User | |
run: | | |
git config --local user.email "$GIT_USER_EMAIL" | |
git config --local user.name "$GIT_USER_NAME" | |
git config --local pull.ff only | |
- name: Install commitizen | |
run: pip install -U commitizen | |
- name: Get version | |
id: version | |
run: | | |
version=$(cz bump --dry-run --no-verify | grep tag | sed 's/tag to create: v//') | |
echo "version=$version" >> $GITHUB_OUTPUT | |
- name: Update vendor hash | |
run: bash update-nix-hashes.sh "${{ steps.version.outputs.version }}" | |
- name: Commit vendor hash update | |
run: | | |
git config --local user.email "${{ env.GIT_USER_EMAIL }}" | |
git config --local user.name "${{ env.GIT_USER_NAME }}" | |
git add flake.nix | |
git commit -m "chore(ci): update vendor hash for version ${{ steps.version.outputs.version }}" | |
- id: cz | |
name: Create bump and changelog | |
run: | | |
cz bump --changelog --yes | |
export REV=`cz version --project` | |
echo "version=$REV" >> $GITHUB_OUTPUT | |
- name: Push changes | |
uses: Woile/github-push-action@master | |
with: | |
github_token: ${{ secrets.ACCESS_TOKEN }} | |
tags: "true" | |
branch: "main" | |
- name: Print Version | |
run: echo "Bumped to version ${{ steps.cz.outputs.version }}" | |
release: | |
runs-on: ubuntu-latest | |
name: "Release service" | |
needs: | |
- bump_version | |
steps: | |
- name: Check out | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: "${{ secrets.ACCESS_TOKEN }}" | |
ref: "main" | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.21.x | |
- name: Config private packages | |
run: git config --global url.https://${{ secrets.ACCESS_TOKEN }}@github.com/Drafteame.insteadOf https://github.com/Drafteame | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v6 | |
with: | |
distribution: goreleaser | |
version: latest | |
args: release --clean | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SLACK_WEBHOOK: ${{ secrets.SLACK_RELEASE_WEBHOOK }} |