Artifacts #25
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: Artifacts | |
on: | |
release: | |
types: [ published ] | |
workflow_dispatch: | |
inputs: | |
dry: | |
description: 'Run the workflow in dry mode' | |
type: boolean | |
required: false | |
default: false | |
jobs: | |
ubuntu: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: dart-lang/setup-dart@v1 | |
- name: Dart SDK | |
run: dart --version | |
- uses: actions/checkout@v5 | |
- name: Install dependencies | |
run: dart pub get | |
- name: Build Artifact | |
run: dart compile exe bin/spider.dart -o bin/spider | |
- name: Archive | |
run: tar -czf spider-${{ github.event.release.tag_name }}-linux-amd64.tar.gz bin/spider | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ubuntu | |
path: spider-${{ github.event.release.tag_name }}-linux-amd64.tar.gz | |
mac: | |
runs-on: macos-latest | |
steps: | |
- uses: dart-lang/setup-dart@v1 | |
- name: Dart SDK | |
run: dart --version | |
- uses: actions/checkout@v5 | |
- name: Install dependencies | |
run: dart pub get | |
- name: Build Artifact | |
run: dart compile exe bin/spider.dart -o bin/spider | |
- name: Archive | |
run: tar -czf spider-${{ github.event.release.tag_name }}-macos.tar.gz bin/spider | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: macos | |
path: spider-${{ github.event.release.tag_name }}-macos.tar.gz | |
windows: | |
runs-on: windows-latest | |
steps: | |
- uses: dart-lang/setup-dart@v1 | |
- name: Dart SDK | |
run: dart --version | |
- uses: actions/checkout@v5 | |
- name: Install dependencies | |
run: dart pub get | |
- name: Build Artifact | |
run: dart compile exe bin/spider.dart -o bin/spider.exe | |
- name: Archive | |
run: tar.exe -a -c -f spider-${{ github.event.release.tag_name }}-windows.zip bin/spider.exe | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: windows | |
path: spider-${{ github.event.release.tag_name }}-windows.zip | |
upload: | |
needs: [ ubuntu, mac, windows ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v5 | |
with: | |
path: dist | |
merge-multiple: true | |
- name: Display structure of downloaded files | |
run: ls -R dist | |
- name: Upload binaries to release | |
uses: svenstaro/upload-release-action@v2 | |
# Do not run for dry run | |
if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.dry == false }} | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: dist/artifact/* | |
tag: ${{ github.ref }} | |
file_glob: true | |
- name: Call Update Homebrew formula webhook | |
uses: peter-evans/repository-dispatch@v4 | |
if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.dry == false }} | |
with: | |
token: ${{ secrets.PAT_HOMEBREW_SPIDER_REPO }} | |
repository: BirjuVachhani/homebrew-spider | |
event-type: update-formula | |
client-payload: '{"version": "${{ github.event.release.tag_name }}"}' |