Publish On Tag #48
Workflow file for this run
This file contains hidden or 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: Publish On Tag | |
| on: | |
| push: | |
| tags: | |
| - '[0-9]+\.[0-9]+\.[0-9]+' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Get Latest Tag | |
| id: get_latest_tag | |
| run: | | |
| TAG=$(git describe --tags --abbrev=0) | |
| echo "tag=$TAG" >> $GITHUB_OUTPUT | |
| echo "Latest Tag: $TAG" | |
| - name: Package Plugin | |
| id: package_plugin | |
| run: | | |
| PLUGIN_NAME="typora-plugin" | |
| VERSION_JSON="plugin/bin/version.json" | |
| PLUGIN_VERSION="${{ steps.get_latest_tag.outputs.tag }}" | |
| ZIP_NAME="${PLUGIN_NAME}@v${PLUGIN_VERSION}.zip" | |
| PUBLISHED_AT=$(date -u +'%Y-%m-%dT%H:%M:%SZ') | |
| echo "Creating $VERSION_JSON" | |
| echo "{ \"tag_name\": \"${PLUGIN_VERSION}\", \"name\": \"${PLUGIN_VERSION}\", \"published_at\": \"${PUBLISHED_AT}\" }" > $VERSION_JSON | |
| echo "Creating zip archive: $ZIP_NAME" | |
| zip -r "$ZIP_NAME" plugin/ | |
| echo "zip_name=$ZIP_NAME" >> $GITHUB_OUTPUT | |
| echo "Zip file created: $ZIP_NAME" | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| files: ${{ steps.package_plugin.outputs.zip_name }} |