Skip to content

Commit

Permalink
Update zip-and-release.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
terual authored Jan 28, 2025
1 parent 03cda19 commit 4f16d22
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/zip-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,29 @@ jobs:
name: Zip and release
runs-on: ubuntu-latest
steps:
- name: Install dependencies
run: sudo apt-get --no-install-recommends -yq install xmlstarlet

- name: Checkout code
uses: actions/checkout@v2

- name: Zip plugin and update repo.xml
run: |
xmlstarlet ed --inplace --update "//extension/version" --value "${{ github.event.inputs.version }}" install.xml
zip -r ${{ github.event.repository.name }}-${{ github.event.inputs.version }}.zip . -x ".git/*" ".github/*" "repo.xml"
export SHA1SUM=`sha1sum "${{ github.event.repository.name }}-${{ github.event.inputs.version }}.zip" | awk '{ print $1 }'`
export ZIP_URL="https://github.com/${{ github.repository }}/releases/download/${{ github.event.inputs.version }}/${{ github.event.repository.name }}-${{ github.event.inputs.version }}.zip"
python -c "from xml.etree import ElementTree as et; tree = et.parse('repo.xml'); tree.find('.//sha').text = '$SHA1SUM'; tree.find('.//url').text = '$ZIP_URL'; tree.write('repo.xml')"
xmlstarlet ed --inplace --update "//extensions/plugins/plugin/sha" --value "$SHA1SUM" repo.xml
xmlstarlet ed --inplace --update "//extensions/plugins/plugin/url" --value "$ZIP_URL" repo.xml
xmlstarlet ed --inplace --update "//extensions/plugins/plugin/@version" --value "${{ github.event.inputs.version }}" repo.xml
- name: Commit changes
run: |
git config user.name github-actions
git config user.email [email protected]
git commit -a -m "Release ${{ github.event.inputs.version }}"
git push
- name: Create Release
id: create_release
uses: actions/create-release@v1
Expand All @@ -35,6 +44,7 @@ jobs:
release_name: Release ${{ github.event.inputs.version }}
draft: false
prerelease: false

- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
Expand All @@ -45,4 +55,3 @@ jobs:
asset_path: ./${{ github.event.repository.name }}-${{ github.event.inputs.version }}.zip
asset_name: ${{ github.event.repository.name }}-${{ github.event.inputs.version }}.zip
asset_content_type: application/zip

0 comments on commit 4f16d22

Please sign in to comment.