|
1 | | -name: Plugin release |
2 | | - |
| 1 | +name: Release Obsidian Plugin |
3 | 2 | on: |
4 | 3 | push: |
5 | 4 | tags: |
6 | 5 | - "*" |
7 | | - |
8 | 6 | jobs: |
9 | 7 | build: |
10 | | - runs-on: self-hosted |
| 8 | + runs-on: ubuntu-latest |
11 | 9 | steps: |
12 | | - - uses: actions/checkout@v2 |
13 | | - - uses: denolib/setup-deno@v2 |
| 10 | + - uses: actions/checkout@v3 |
14 | 11 | with: |
15 | | - deno-version: v1.x |
16 | | - - name: npm build |
| 12 | + fetch-depth: 0 # otherwise, you will failed to push refs to dest repo |
| 13 | + - name: Use Node.js |
| 14 | + uses: actions/setup-node@v3 |
| 15 | + with: |
| 16 | + node-version: 16 |
| 17 | + - name: Get Version |
| 18 | + id: version |
| 19 | + run: | |
| 20 | + echo "::set-output name=tag::$(git describe --abbrev=0)" |
| 21 | + - name: Build |
| 22 | + id: build |
17 | 23 | run: | |
18 | 24 | npm install |
19 | 25 | npm run build -- --environment BUILD:production |
| 26 | + # Create the release on github |
20 | 27 | - name: Create Release |
21 | | - # https://github.com/ncipollo/release-action |
22 | | - |
| 28 | + id: create_release |
| 29 | + uses: actions/create-release@v1 |
| 30 | + env: |
| 31 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 32 | + VERSION: ${{ github.ref }} |
| 33 | + with: |
| 34 | + tag_name: ${{ github.ref }} |
| 35 | + release_name: ${{ github.ref }} |
| 36 | + draft: false |
| 37 | + prerelease: false |
| 38 | + # Upload the main.js |
| 39 | + - name: Upload main.js |
| 40 | + id: upload-main |
| 41 | + uses: actions/upload-release-asset@v1 |
| 42 | + env: |
| 43 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 44 | + with: |
| 45 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 46 | + asset_path: ./dist/main.js |
| 47 | + asset_name: main.js |
| 48 | + asset_content_type: text/javascript |
| 49 | + # Upload the manifest.json |
| 50 | + - name: Upload manifest.json |
| 51 | + id: upload-manifest |
| 52 | + uses: actions/upload-release-asset@v1 |
| 53 | + env: |
| 54 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 55 | + with: |
| 56 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 57 | + asset_path: ./manifest.json |
| 58 | + asset_name: manifest.json |
| 59 | + asset_content_type: application/json |
| 60 | + # Upload the style.css |
| 61 | + - name: Upload styles.css |
| 62 | + id: upload-css |
| 63 | + uses: actions/upload-release-asset@v1 |
| 64 | + env: |
| 65 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
23 | 66 | with: |
24 | | - artifacts: "dist/main.js,manifest.json,styles.css" |
25 | | - token: ${{ secrets.GITHUB_TOKEN }} |
| 67 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 68 | + asset_path: ./styles.css |
| 69 | + asset_name: styles.css |
| 70 | + asset_content_type: text/css |
0 commit comments