|
@@ -1,9 +1,10 @@
|
|
|
name: release
|
|
name: release
|
|
|
|
|
|
|
|
-on:
|
|
|
|
|
|
|
+on:
|
|
|
|
|
+ workflow_dispatch:
|
|
|
push:
|
|
push:
|
|
|
- tags:
|
|
|
|
|
- - "v*"
|
|
|
|
|
|
|
+ branches:
|
|
|
|
|
+ - main
|
|
|
|
|
|
|
|
jobs:
|
|
jobs:
|
|
|
release:
|
|
release:
|
|
@@ -14,11 +15,56 @@ jobs:
|
|
|
|
|
|
|
|
- name: Checkout
|
|
- name: Checkout
|
|
|
uses: actions/checkout@v4
|
|
uses: actions/checkout@v4
|
|
|
|
|
+ with:
|
|
|
|
|
+ fetch-depth: 0
|
|
|
|
|
+
|
|
|
|
|
+ - name: Check version
|
|
|
|
|
+ id: version-check
|
|
|
|
|
+ run: |
|
|
|
|
|
+ chmod +x ./scripts/is-newer-version.bash
|
|
|
|
|
+ chmod +x ./scripts/get-version.bash
|
|
|
|
|
+ VERSION=$(./scripts/is-newer-version.bash)
|
|
|
|
|
+ echo "version=${VERSION}" >> $GITHUB_OUTPUT
|
|
|
|
|
+ if [ "$VERSION" != "0" ]; then
|
|
|
|
|
+ echo "New version detected: $VERSION"
|
|
|
|
|
+ else
|
|
|
|
|
+ echo "No new version to release"
|
|
|
|
|
+ fi
|
|
|
|
|
+
|
|
|
|
|
+ - name: Push tag
|
|
|
|
|
+ if: steps.version-check.outputs.version != '0'
|
|
|
|
|
+ run: |
|
|
|
|
|
+ tag="v${{ steps.version-check.outputs.version }}"
|
|
|
|
|
+ git config user.name "${GITHUB_ACTOR}"
|
|
|
|
|
+ git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
|
|
|
|
|
+ git tag -a "${tag}" -m "Release ${tag}"
|
|
|
|
|
+ git push origin "${tag}"
|
|
|
|
|
+
|
|
|
|
|
+ - name: Checkout
|
|
|
|
|
+ if: steps.version-check.outputs.version != '0'
|
|
|
|
|
+ uses: actions/checkout@v4
|
|
|
|
|
+
|
|
|
|
|
+ - name: Setup Rust
|
|
|
|
|
+ if: steps.version-check.outputs.version != '0'
|
|
|
|
|
+ uses: MatteoH2O1999/setup-rust@v1
|
|
|
|
|
+
|
|
|
|
|
+ - name: Build project
|
|
|
|
|
+ if: steps.version-check.outputs.version != '0'
|
|
|
|
|
+ run: cargo build --release
|
|
|
|
|
+ shell: bash
|
|
|
|
|
+ working-directory: ${{ github.action_path }}
|
|
|
|
|
+
|
|
|
|
|
+ - name: Generate minimized HTML
|
|
|
|
|
+ if: steps.version-check.outputs.version != '0'
|
|
|
|
|
+ run: cargo run --release -- ${{ github.action_path }}/index.html ${{ github.action_path }}/index.min.html
|
|
|
|
|
+ shell: bash
|
|
|
|
|
+ working-directory: ${{ github.action_path }}
|
|
|
|
|
|
|
|
- name: Create release
|
|
- name: Create release
|
|
|
|
|
+ if: steps.version-check.outputs.version != '0'
|
|
|
uses: ncipollo/release-action@v1
|
|
uses: ncipollo/release-action@v1
|
|
|
with:
|
|
with:
|
|
|
token: ${{ secrets.TOKEN }}
|
|
token: ${{ secrets.TOKEN }}
|
|
|
generateReleaseNotes: true
|
|
generateReleaseNotes: true
|
|
|
- tag: ${{ github.ref_name }}
|
|
|
|
|
|
|
+ tag: "v${{ steps.version-check.outputs.version }}"
|
|
|
artifacts: "index.html,index.min.html"
|
|
artifacts: "index.html,index.min.html"
|