|
| 1 | +name: "release" |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - "main" |
| 7 | + |
| 8 | +jobs: |
| 9 | + create-release: |
| 10 | + name: "Release" |
| 11 | + runs-on: ubuntu-latest |
| 12 | + |
| 13 | + steps: |
| 14 | + # ... |
| 15 | + - name: "Build & test" |
| 16 | + run: | |
| 17 | + echo "done!" |
| 18 | + - uses: "marvinpinto/action-automatic-releases@v1.2.1" |
| 19 | + env: |
| 20 | + ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true' |
| 21 | + with: |
| 22 | + repo_token: "${{ secrets.GITHUB_TOKEN }}" |
| 23 | + automatic_release_tag: "latest" |
| 24 | + prerelease: false |
| 25 | + title: "Development Build [TODO: Replace label and title with version number]" |
| 26 | + files: | |
| 27 | + LICENSE.txt |
| 28 | +
|
| 29 | + upload-artifacts: |
| 30 | + name: Build on ${{ matrix.os }} |
| 31 | + needs: [ create-release ] |
| 32 | + strategy: |
| 33 | + fail-fast: false |
| 34 | + matrix: |
| 35 | + os: [ubuntu-latest, windows-latest, macos-latest] |
| 36 | + include: |
| 37 | + - os: ubuntu-latest |
| 38 | + npm_command: npm run build:lin |
| 39 | + - os: windows-latest |
| 40 | + npm_command: npm run build:win |
| 41 | + - os: macos-latest |
| 42 | + npm_command: npm run build:mac |
| 43 | + |
| 44 | + runs-on: ${{ matrix.os }} |
| 45 | + steps: |
| 46 | + # Setup Builder |
| 47 | + - uses: actions/checkout@v4 |
| 48 | + - uses: actions/setup-node@v4 |
| 49 | + - uses: dart-lang/setup-dart@v1 |
| 50 | + with: |
| 51 | + sdk: 3.8 |
| 52 | + |
| 53 | + - name: Install ImageMagick |
| 54 | + shell: bash |
| 55 | + run: | |
| 56 | + if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then |
| 57 | + sudo apt-get update && sudo apt-get install -y imagemagick libfuse2 |
| 58 | + elif [[ "${{ matrix.os }}" == "macos-latest" ]]; then |
| 59 | + brew install imagemagick |
| 60 | + elif [[ "${{ matrix.os }}" == "windows-latest" ]]; then |
| 61 | + choco install imagemagick -y |
| 62 | + fi |
| 63 | +
|
| 64 | + - name: Install NodeJS Dependencies |
| 65 | + working-directory: ./standalone |
| 66 | + run: npm install |
| 67 | + |
| 68 | + - name: Generate Icons |
| 69 | + working-directory: ./standalone |
| 70 | + shell: bash |
| 71 | + run: | |
| 72 | + chmod +x ./generate-icons.sh |
| 73 | + ./generate-icons.sh ../web/images/origami-icon-thin-seam.png |
| 74 | +
|
| 75 | + - name: Run build |
| 76 | + working-directory: ./standalone |
| 77 | + run: ${{ matrix.npm_command }} |
| 78 | + |
| 79 | + # Upload the generated artifacts (pattern: scadnano*.<ext>) |
| 80 | + - name: Upload Build Artifact |
| 81 | + uses: actions/upload-artifact@v4 |
| 82 | + with: |
| 83 | + name: build-${{ matrix.os }} |
| 84 | + path: | |
| 85 | + standalone/dist/scadnano*.* |
| 86 | + !standalone/dist/*.blockmap |
| 87 | +
|
| 88 | + attach-to-release: |
| 89 | + name: Attach artifacts to release |
| 90 | + runs-on: ubuntu-latest |
| 91 | + needs: [upload-artifacts, create-release] |
| 92 | + |
| 93 | + steps: |
| 94 | + - name: Download all artifacts |
| 95 | + uses: actions/download-artifact@v4 |
| 96 | + with: |
| 97 | + path: ./release-files |
| 98 | + |
| 99 | + - name: Upload to GitHub Release |
| 100 | + uses: softprops/action-gh-release@v1 |
| 101 | + with: |
| 102 | + tag_name: latest |
| 103 | + files: | |
| 104 | + ./release-files/**/scadnano*.* |
| 105 | + !./release-files/**/*.blockmap |
| 106 | + env: |
| 107 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments