Skip to content

Create Release

Create Release #61

Workflow file for this run

name: Create Release
on:
workflow_dispatch:
schedule:
- cron: '0 9 * * 1'
jobs:
version:
name: Get versions and meta
timeout-minutes: 5
runs-on: ubuntu-latest
outputs:
LATEST_TAG_NAME: ${{ steps.getSimpleIconsVersion.outputs.latest_tag_name }}
LATEST_RELEASE_NAME: ${{ steps.getSimpleIconsVersion.outputs.latest_release_name }}
PREVIOUS_VERSION: ${{ steps.getSimpleIconsVersion.outputs.previous_version }}
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Get Simple Icons version and release name plus previous version of icon pack
id: getSimpleIconsVersion
run: |
simple_icons_release_data="$(curl --retry 5 -s https://api.github.com/repos/simple-icons/simple-icons/releases/latest)"
echo "latest_tag_name=$(echo "$simple_icons_release_data" | jq -r '.tag_name')" >> $GITHUB_OUTPUT
echo "latest_release_name=$(echo "$simple_icons_release_data" | jq -r '.name')" >> $GITHUB_OUTPUT
echo "previous_version=$(jq -r '.Version' template/manifest.json)" >> $GITHUB_OUTPUT
build:
name: Build Icon Pack
timeout-minutes: 10
needs: version
if: ${{ needs.version.outputs.LATEST_TAG_NAME != needs.version.outputs.PREVIOUS_VERSION }}
runs-on: windows-latest
permissions: write-all
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Download latest Simple Icons release
run: |
Invoke-WebRequest -Uri "https://github.com/simple-icons/simple-icons/archive/refs/tags/${{ needs.version.outputs.LATEST_TAG_NAME }}.zip" -OutFile "simple-icons-${{ needs.version.outputs.LATEST_TAG_NAME }}.zip"
shell: pwsh
- name: Extract Simple Icons
run: 7z x simple-icons-${{ needs.version.outputs.LATEST_TAG_NAME }}.zip -o./simple-icons-${{ needs.version.outputs.LATEST_TAG_NAME }}
shell: cmd
- name: Install python packages
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run script/main.py with the latest Simple Icons release
working-directory: script
run: python main.py ./../simple-icons-${{ needs.version.outputs.LATEST_TAG_NAME }}/simple-icons-${{ needs.version.outputs.LATEST_TAG_NAME }} ${{ needs.version.outputs.LATEST_TAG_NAME }}
shell: pwsh
- name: Upload Icon Pack
uses: actions/upload-artifact@v3
with:
name: icon-pack-${{ needs.version.outputs.LATEST_TAG_NAME }}
path: ./out/com.mackenly.simpleiconsstreamdeck.streamDeckIconPack
if-no-files-found: error
retention-days: 2
release:
name: Create new Release
timeout-minutes: 5
needs: [version, build]
if: ${{ needs.version.outputs.LATEST_TAG_NAME != needs.version.outputs.PREVIOUS_VERSION }}
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Update manifest.json template version and README.md
run: |
sed -i "s/\"Version\": \".*\"/\"Version\": \"${{ needs.version.outputs.LATEST_TAG_NAME }}\"/g" template/manifest.json
sed -i 's/${{ needs.version.outputs.PREVIOUS_VERSION }}/${{ needs.version.outputs.LATEST_TAG_NAME }}/g' README.md
- name: Commit and push changes to manifest.json and README.md
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add template/manifest.json
git add README.md
git commit -m "Update to version ${{ needs.version.outputs.LATEST_TAG_NAME }} - ${{ needs.version.outputs.LATEST_RELEASE_NAME }}"
git push
# tag the commit
git tag v${{ needs.version.outputs.LATEST_TAG_NAME }}
git push origin v${{ needs.version.outputs.LATEST_TAG_NAME }}
- name: Download pack artifact
uses: actions/download-artifact@v3
with:
name: icon-pack-${{ needs.version.outputs.LATEST_TAG_NAME }}
path: ./out
- name: Create Release
id: create_release
uses: ncipollo/release-action@v1
with:
artifacts: ./out/com.mackenly.simpleiconsstreamdeck.streamDeckIconPack
allowUpdates: true
artifactErrorsFailBuild: true
body: |
# Simple Icons Stream Deck Icon Pack Version ${{ needs.version.outputs.LATEST_TAG_NAME }}
${{ needs.version.outputs.LATEST_RELEASE_NAME }}
[Simple-icons Release Notes](https://github.com/simple-icons/simple-icons/releases/tag/${{ needs.version.outputs.LATEST_TAG_NAME }})
makeLatest: true
name: v${{ needs.version.outputs.LATEST_TAG_NAME }}
replacesArtifacts: true
removeArtifacts: true
tag: v${{ needs.version.outputs.LATEST_TAG_NAME }}