Auto Update when upstream releases #837
Workflow file for this run
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: Auto Update when upstream releases | |
on: | |
schedule: | |
- cron: '0 3 * * *' | |
workflow_dispatch: | |
jobs: | |
get-version: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '16.13.0' | |
- name: Fetch release version | |
id: upstream | |
run: | | |
echo ::set-output name=release_tag::$(curl "https://raw.githubusercontent.com/PKief/vscode-material-icon-theme/main/package.json" \ | |
| jq -r .version) | |
echo ::set-output name=current_tag::$(<upstream.version) | |
- name: Attempt update | |
if: steps.upstream.outputs.release_tag != steps.upstream.outputs.current_tag | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: npm ci && npm run update | |
- name: Get package version | |
id: package-version | |
if: steps.upstream.outputs.release_tag != steps.upstream.outputs.current_tag | |
run: echo ::set-output name=package_version::v$(jq -r .version package.json) | |
- name: Commit updated files | |
if: steps.upstream.outputs.release_tag != steps.upstream.outputs.current_tag | |
uses: EndBug/add-and-commit@v7 | |
with: | |
add: '.' | |
message: '[auto] update to upstream ${{steps.upstream.outputs.release_tag}}' | |
tag: '${{steps.package-version.outputs.package_version}}' | |
- name: Release | |
if: steps.upstream.outputs.release_tag != steps.upstream.outputs.current_tag | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: '${{steps.package-version.outputs.package_version}}' | |
body: Built with icons from VSCode Material Icon Theme ${{steps.upstream.outputs.release_tag}} | |
files: '*.zip' | |
- name: Upload to chrome store | |
if: steps.upstream.outputs.release_tag != steps.upstream.outputs.current_tag | |
continue-on-error: true | |
uses: trmcnvn/chrome-addon@v2 | |
with: | |
extension: bggfcpfjbdkhfhfmkjpbhnkhnpjjeomc | |
zip: github-material-icons-chrome-extension.zip | |
client-id: ${{ secrets.CHROME_CLIENT_ID }} | |
client-secret: ${{ secrets.CHROME_CLIENT_SECRET }} | |
refresh-token: ${{ secrets.CHROME_REFRESH_TOKEN }} | |
- name: Upload to edge store | |
if: steps.upstream.outputs.release_tag != steps.upstream.outputs.current_tag | |
continue-on-error: true | |
uses: wdzeng/edge-addon@v1 | |
with: | |
product-id: d7692295-d84f-4bf5-9447-3cbb6ae29517 | |
zip-path: github-material-icons-edge-extension.zip | |
client-id: ${{ secrets.EDGE_CLIENT_ID }} | |
client-secret: ${{ secrets.EDGE_CLIENT_SECRET }} | |
access-token-url: ${{ secrets.EDGE_ACCESS_TOKEN_URL }} | |
- name: Upload to firefox store | |
if: steps.upstream.outputs.release_tag != steps.upstream.outputs.current_tag | |
continue-on-error: true | |
run: npx web-ext sign -s ./dist/firefox/ --channel=listed --api-key=${{ secrets.FIREFOX_API_JWT_ISSUER }} --api-secret=${{ secrets.FIREFOX_API_JWT_SECRET }} |