Skip to content

Commit

Permalink
chore(ci): fixed tag version for git checkout branch
Browse files Browse the repository at this point in the history
  • Loading branch information
qwqcode committed Dec 22, 2023
1 parent e4a42d3 commit 60e0e7e
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 10 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/build-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ jobs:
- name: Checkout Code
uses: actions/checkout@v4
with:
ref: ${{ inputs.version }}
# `go-releaser` will read the semver version from git tag name
# `git-chglog` will diff the tag and generate changelog
fetch-depth: 0

# disable cache because the err `no space left on device`
Expand Down Expand Up @@ -78,7 +81,6 @@ jobs:
-v $(pwd):/go/src/${PKG_NAME} \
-w /go/src/${PKG_NAME} \
-e CGO_ENABLED=1 \
-e VERSION=${{ inputs.version }} \
--env-file local/.release-env \
ghcr.io/goreleaser/goreleaser-cross:v${GO_VERSION} \
release --release-notes local/release-notes.md ${{ inputs.dry_run && '--skip=publish' || '' }}
2 changes: 2 additions & 0 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ jobs:
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
ref: ${{ inputs.version }}

# https://github.com/docker/metadata-action
- name: Gen docker meta
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/build-done.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,18 @@ on:
type: number

jobs:
tagging:
done:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
ref: ${{ inputs.version }}

- name: Comment done info
uses: ./.github/actions/comment
if: ${{ inputs.issue_number != 0 }}
with:
issue_number: ${{ inputs.issue_number }}
content: |
🎉 Finished build and publish version ${{ inputs.version }}.
content: |-
🎉 Finished build and publish ${{ inputs.version }} ([NPM Package](https://www.npmjs.com/package/artalk?activeTab=versions) / [Docker Image](https://hub.docker.com/r/artalk/artalk-go/tags) / [Github Release](https://github.com/ArtalkJS/Artalk/releases/tag/${{ inputs.version }})).
4 changes: 2 additions & 2 deletions .github/workflows/build-tagging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
if: ${{ inputs.issue_number != 0 }}
with:
issue_number: ${{ inputs.issue_number }}
content: |
🔖 Tagged version [${{ env.VERSION }}](https://github.com/ArtalkJS/Artalk/tree/${{ env.VERSION }}), also see [CHANGELOG.md](https://github.com/ArtalkJS/Artalk/blob/master/CHANGELOG.md).
content: |-
🔖 Tagged version [${{ env.VERSION }}](https://github.com/ArtalkJS/Artalk/tree/${{ env.VERSION }}) and updated the [CHANGELOG.md](https://github.com/ArtalkJS/Artalk/blob/master/CHANGELOG.md).
outputs:
version: ${{ env.VERSION }}
2 changes: 2 additions & 0 deletions .github/workflows/build-ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ jobs:
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
ref: ${{ inputs.version }}

- name: Use pnpm
uses: pnpm/action-setup@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
dry_run:
description: 'Dry run'
type: boolean
default: false
default: true
build_items:
description: 'Build items'
type: string
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
- name: Checkout Code
uses: actions/checkout@v4
with:
ref: master
fetch-depth: 0

- name: Setup Node
Expand All @@ -32,6 +33,9 @@ jobs:
node-version: 18.x
registry-url: https://registry.npmjs.org/

- name: Setup semver
run: npm install -g semver

- name: Handle Version Number
run: |
PREV_VERSION="$(git describe --tags --abbrev=0)"
Expand Down Expand Up @@ -66,18 +70,18 @@ jobs:

- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
if: ${{ !inputs.dry_run }}
with:
branch: "release/${{ env.VERSION }}"
commit-message: "chore: release ${{ env.VERSION }}"
title: "chore: release ${{ env.VERSION }}"
labels: release
body: |
# Release ${{ env.VERSION }} 📦🚀
## Release ${{ env.VERSION }} 📦🚀
This PR is auto-generated, please check the changelog and confirm the release. 😀
The build workflow will be triggered after the PR is merged.
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
assignees: ${{ github.actor }}
draft: ${{ inputs.dry_run }}

0 comments on commit 60e0e7e

Please sign in to comment.