π· CI: Merge dev by GitOK #79
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] | |
tags: | |
- '*' | |
permissions: | |
contents: write | |
env: | |
tag: ${{ github.event.head_commit.id }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Current User | |
run: whoami | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Prepare | |
run: | | |
npm -v | |
npm i -g pnpm | |
- name: Install | |
run: pnpm i --prod | |
- name: Build | |
run: npm run build | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist | |
path: dist | |
retention-days: 1 | |
tag: | |
needs: [build] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Generate Tag | |
run: | | |
git config --global user.name "GitHub Action" | |
git config --global user.email "action@github.com" | |
npm version patch -m "π· CI: Upgrade to v%s" | |
git push origin main --tags | |
- name: Read Version | |
run: | | |
version=$(node -p "require('./package.json').version") | |
echo $version | |
echo "${version}" >> version.txt | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: version | |
path: version.txt | |
retention-days: 1 | |
rebase_dev: | |
needs: | |
- tag | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Configure Git | |
run: | | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
- name: Rebase dev on main | |
run: | | |
git fetch origin dev:refs/remotes/origin/dev | |
git checkout -b dev origin/dev | |
git rebase origin/main | |
- name: Push the rebased dev branch | |
run: git push origin dev:dev --force | |
release: | |
runs-on: ubuntu-latest | |
needs: [tag] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: version | |
path: temp | |
- run: ls -alhR | |
- name: Read Version | |
run: | | |
version=$(cat temp/version.txt) | |
echo $version | |
echo "tag=v$version" >> $GITHUB_ENV | |
- uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ env.tag }} | |
files: | | |
./**/*.dmg | |
./**/*.zip | |
./**/*.exe | |
./**/*.pkg | |
./**/*.deb | |
./**/*.ipa | |
./**/*.AppImage | |
./**/*.snap | |
clear: | |
needs: | |
- release | |
runs-on: ubuntu-latest | |
permissions: | |
actions: write | |
steps: | |
- name: Clean Artifact | |
uses: geekyeggo/delete-artifact@v4 | |
with: | |
token: ${{ github.token }} | |
name: | | |
dist | |
version |