refactor(theme):重构主题存储和获取逻辑 #137
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: Go | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
- name: Manage Version | |
run: | | |
git fetch --prune --unshallow --tags | |
GIT_SHA="$(git rev-parse --short HEAD)" | |
CUR_TAG="$(git tag -l | tail -1)" | |
MODULE_VERSION="$(git tag -l | tail -1)" | |
echo "SHORT_SHA=$GIT_SHA" >> $GITHUB_ENV | |
echo "WEJH_VER=$MODULE_VERSION" >> $GITHUB_ENV | |
if [[ -z $CUR_TAG ]]; then | |
echo "OLD_PRE_TAG=NULL" >> $GITHUB_ENV | |
else | |
echo "OLD_PRE_TAG=$CUR_TAG" >> $GITHUB_ENV | |
fi | |
- name: Build | |
run: go build -v . | |
- name: Test | |
run: go test -v . | |
- name: Pack Artifacts | |
run: | | |
zip -r wejh-go-v${WEJH_VER_VER}-DEBUG-alpha-${SHORT_SHA}.zip wejh-go | |
- name: Generate Prerelease Release Notes | |
run: | | |
echo '### Disclaimer:' >> ReleaseNotes.md | |
echo '***This alpha version is for testing only.***' >> ReleaseNotes.md | |
echo 'It is not ready for daily use and we do not guarantee its usability.' >> ReleaseNotes.md | |
echo '### The latest five updates are:' >> ReleaseNotes.md | |
git log -"5" --format="- %H %s" | sed '/^$/d' >> ReleaseNotes.md | |
- name: Delete Old Prerelease | |
uses: dev-drprasad/delete-tag-and-release@v0.2.1 | |
with: | |
tag_name: ${{ env.OLD_PRE_TAG }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish GitHub Release | |
uses: ncipollo/release-action@v1 | |
with: | |
prerelease: true | |
bodyFile: ReleaseNotes.md | |
artifacts: "*.zip" | |
tag: "${{ env.WEJH_VER }}" | |
token: ${{ secrets.GITHUB_TOKEN }} |