update #52
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: Upload Addon to CurseForge | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
upload: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Determine version number | |
id: latest_version | |
run: | | |
# Extract the version number from the TOC file | |
echo "::set-output name=v::$(grep -oP 'Version: \Kv\d+\.\d+\.\d+' AvgItemLvl/AvgItemLvl.toc)" | |
- name: Create version tag | |
shell: bash | |
env: | |
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }} | |
run: | | |
git config user.name "GitHub Action" | |
git config user.email "github-action@users.noreply.github.com" | |
git fetch --prune --unshallow | |
latest_tag=$(git describe --tags --abbrev=0) | |
if [[ "$latest_tag" < ${{ steps.latest_version.outputs.v }} ]]; then | |
git tag ${{ steps.latest_version.outputs.v }} | |
git push origin ${{ steps.latest_version.outputs.v }} | |
else | |
echo "Latest tag ($latest_tag) is already up-to-date with version ${{ steps.latest_version.outputs.v }}" | |
fi | |
- name: Zip addon contents | |
run: | | |
rm -rf .git | |
rm -rf .github | |
zip -r AvgItemLvl-${{ steps.latest_version.outputs.v }}.zip . | |
- name: Upload Addon to CurseForge | |
uses: itsmeow/curseforge-upload@v3 | |
with: | |
token: ${{ secrets.CURSEFORGE_API_TOKEN }} | |
project_id: ${{ secrets.CURSEFORGE_ADDON_ID }} | |
game_endpoint: "wow" | |
release_type: release | |
changelog: "${{ steps.latest_version.outputs.v }} update" | |
file_path: AvgItemLvl-${{ steps.latest_version.outputs.v }}.zip |