|
1 | 1 | name: Build obsidian plugin |
2 | 2 |
|
3 | 3 | on: |
4 | | - push: |
5 | | - # Sequence of patterns matched against refs/tags |
6 | | - tags: |
7 | | - - "*" # Push events to matching any tag format, i.e. 1.0, 20.15.10 |
| 4 | + push: |
| 5 | + # Sequence of patterns matched against refs/tags |
| 6 | + tags: |
| 7 | + - "*" # Push events to matching any tag format, i.e. 1.0, 20.15.10 |
8 | 8 |
|
9 | 9 | env: |
10 | | - PLUGIN_NAME: obsidian-pw # Change this to the name of your plugin-id folder |
| 10 | + PLUGIN_NAME: obsidian-pw # Change this to the name of your plugin-id folder |
11 | 11 |
|
12 | 12 | jobs: |
13 | | - build: |
14 | | - runs-on: ubuntu-latest |
| 13 | + build: |
| 14 | + runs-on: ubuntu-latest |
15 | 15 |
|
16 | | - steps: |
17 | | - - uses: actions/checkout@v2 |
18 | | - - name: Use Node.js |
19 | | - uses: actions/setup-node@v1 |
20 | | - with: |
21 | | - node-version: "14.x" # You might need to adjust this value to your own version |
22 | | - - name: Build |
23 | | - id: build |
24 | | - run: | |
25 | | - yarn |
26 | | - yarn run build --if-present |
27 | | - mkdir ${{ env.PLUGIN_NAME }} |
28 | | - cp main.js manifest.json styles.css ${{ env.PLUGIN_NAME }} |
29 | | - zip -r ${{ env.PLUGIN_NAME }}.zip ${{ env.PLUGIN_NAME }} |
30 | | - ls |
31 | | - echo "::set-output name=tag_name::$(git tag --sort version:refname | tail -n 1)" |
32 | | - - name: Create Release |
33 | | - id: create_release |
34 | | - uses: actions/create-release@v1 |
35 | | - env: |
36 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
37 | | - VERSION: ${{ github.ref }} |
38 | | - with: |
39 | | - tag_name: ${{ github.ref }} |
40 | | - release_name: ${{ github.ref }} |
41 | | - draft: false |
42 | | - prerelease: false |
43 | | - - name: Upload zip file |
44 | | - id: upload-zip |
45 | | - uses: actions/upload-release-asset@v1 |
46 | | - env: |
47 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
48 | | - with: |
49 | | - upload_url: ${{ steps.create_release.outputs.upload_url }} |
50 | | - asset_path: ./${{ env.PLUGIN_NAME }}.zip |
51 | | - asset_name: ${{ env.PLUGIN_NAME }}-${{ steps.build.outputs.tag_name }}.zip |
52 | | - asset_content_type: application/zip |
53 | | - - name: Upload main.js |
54 | | - id: upload-main |
55 | | - uses: actions/upload-release-asset@v1 |
56 | | - env: |
57 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
58 | | - with: |
59 | | - upload_url: ${{ steps.create_release.outputs.upload_url }} |
60 | | - asset_path: ./main.js |
61 | | - asset_name: main.js |
62 | | - asset_content_type: text/javascript |
63 | | - - name: Upload manifest.json |
64 | | - id: upload-manifest |
65 | | - uses: actions/upload-release-asset@v1 |
66 | | - env: |
67 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
68 | | - with: |
69 | | - upload_url: ${{ steps.create_release.outputs.upload_url }} |
70 | | - asset_path: ./manifest.json |
71 | | - asset_name: manifest.json |
72 | | - asset_content_type: application/json |
73 | | - - name: Upload styles.css |
74 | | - id: upload-css |
75 | | - uses: actions/upload-release-asset@v1 |
76 | | - env: |
77 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
78 | | - with: |
79 | | - upload_url: ${{ steps.create_release.outputs.upload_url }} |
80 | | - asset_path: ./styles.css |
81 | | - asset_name: styles.css |
82 | | - asset_content_type: text/css |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v2 |
| 18 | + - name: Use Node.js |
| 19 | + uses: actions/setup-node@v1 |
| 20 | + with: |
| 21 | + node-version: "18.x" # You might need to adjust this value to your own version |
| 22 | + - name: Build |
| 23 | + id: build |
| 24 | + run: | |
| 25 | + yarn |
| 26 | + yarn run build --if-present |
| 27 | + mkdir ${{ env.PLUGIN_NAME }} |
| 28 | + cp main.js manifest.json styles.css ${{ env.PLUGIN_NAME }} |
| 29 | + zip -r ${{ env.PLUGIN_NAME }}.zip ${{ env.PLUGIN_NAME }} |
| 30 | + ls |
| 31 | + echo "::set-output name=tag_name::$(git tag --sort version:refname | tail -n 1)" |
| 32 | + - name: Create Release |
| 33 | + id: create_release |
| 34 | + uses: actions/create-release@v1 |
| 35 | + env: |
| 36 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 37 | + VERSION: ${{ github.ref }} |
| 38 | + with: |
| 39 | + tag_name: ${{ github.ref }} |
| 40 | + release_name: ${{ github.ref }} |
| 41 | + draft: false |
| 42 | + prerelease: false |
| 43 | + - name: Upload zip file |
| 44 | + id: upload-zip |
| 45 | + uses: actions/upload-release-asset@v1 |
| 46 | + env: |
| 47 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 48 | + with: |
| 49 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 50 | + asset_path: ./${{ env.PLUGIN_NAME }}.zip |
| 51 | + asset_name: ${{ env.PLUGIN_NAME }}-${{ steps.build.outputs.tag_name }}.zip |
| 52 | + asset_content_type: application/zip |
| 53 | + - name: Upload main.js |
| 54 | + id: upload-main |
| 55 | + uses: actions/upload-release-asset@v1 |
| 56 | + env: |
| 57 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 58 | + with: |
| 59 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 60 | + asset_path: ./main.js |
| 61 | + asset_name: main.js |
| 62 | + asset_content_type: text/javascript |
| 63 | + - name: Upload manifest.json |
| 64 | + id: upload-manifest |
| 65 | + uses: actions/upload-release-asset@v1 |
| 66 | + env: |
| 67 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 68 | + with: |
| 69 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 70 | + asset_path: ./manifest.json |
| 71 | + asset_name: manifest.json |
| 72 | + asset_content_type: application/json |
| 73 | + - name: Upload styles.css |
| 74 | + id: upload-css |
| 75 | + uses: actions/upload-release-asset@v1 |
| 76 | + env: |
| 77 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 78 | + with: |
| 79 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 80 | + asset_path: ./styles.css |
| 81 | + asset_name: styles.css |
| 82 | + asset_content_type: text/css |
0 commit comments