summary refs log tree commit diff
path: root/.github/workflows/release.yml
blob: 252960f13b6e91ac96dd218113c425f017d4d790 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
on:
  workflow_dispatch:
  push:
    # Sequence of patterns matched against refs/tags
    tags:
      - "v*" # Push events to matching v*, i.e. v1.0, v20.15.10

name: Publish Release

jobs:
  insiders-build:
    strategy:
      matrix:
        os: [windows, macos, ubuntu]
        include:
          - os: windows
            pre: |
              del /F /S /Q node_modules/@fosscord
              mklink /D node_modules/@fosscord/api ../api
              mklink /D node_modules/@fosscord/cdn ../cdn
              mklink /D node_modules/@fosscord/gateway ../gateway
              mklink /D node_modules/@fosscord/util ../util
            build: npx caxa -i .. -m 'This_may_take_a_while_to_run_the_first_time_please_wait...' --output 'fosscord-server-windows.exe' -- '{{caxa}}/node_modules/.bin/node' '{{caxa}}/bundle/dist/start.js'
            artifact: fosscord-server-windows.exe
          - os: macos
            pre: |
              ln -sf node_modules/@fosscord/api ../api 
              ln -sf node_modules/@fosscord/cdn ../cdn 
              ln -sf node_modules/@fosscord/gateway ../gateway 
              ln -sf node_modules/@fosscord/util ../util
            build: npx caxa -i .. -m 'This may take a while to run the first time, please wait...' --output 'fosscord-server.app' -- '{{caxa}}/node_modules/.bin/node' '{{caxa}}/bundle/dist/start.js' && tar -czf 'fosscord-server-macos.app.tgz' 'fosscord-server.app'
            artifact: fosscord-server-macos.app.tgz
          - os: ubuntu
            pre: |
              ln -sf node_modules/@fosscord/api ../api 
              ln -sf node_modules/@fosscord/cdn ../cdn 
              ln -sf node_modules/@fosscord/gateway ../gateway 
              ln -sf node_modules/@fosscord/util ../util
            build: npx caxa -i .. -m 'This may take a while to run the first time, please wait...' --output 'fosscord' -- '{{caxa}}/node_modules/.bin/node' '{{caxa}}/bundle/dist/start.js' && tar -czf 'fosscord-server-linux.tgz' 'fosscord'
            artifact: fosscord-server-linux.tgz
    runs-on: ${{ matrix.os }}-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v2
        env:
          MONGOMS_VERSION: 4.4.3
        with:
          node-version: 14
      - run: |
          cd util
          npm install
          cd ../bundle
          npm install
          npm i caxa
          npm run build
          ${{ matrix.pre }}
          ${{ matrix.build }}
      - uses: actions/upload-artifact@v2
        with:
          name: ${{ matrix.artifact }}
          path: bundle/${{ matrix.artifact }}

  release:
    needs: [insiders-build]
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Extract version
        id: extract_version
        uses: Saionaro/extract-package-version@v1.1.1
        with:
          path: api
      - uses: actions/download-artifact@v2
        with:
          name: fosscord-server-windows.exe
      - uses: actions/download-artifact@v2
        with:
          name: fosscord-server-macos.app.tgz
      - uses: actions/download-artifact@v2
        with:
          name: fosscord-server-linux.tgz
      - uses: actions/create-release@v1
        id: create-release
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          tag_name: v${{ steps.extract_version.outputs.version }}
          release_name: Server v${{ steps.extract_version.outputs.version }}
          draft: false
          prerelease: true # TODO: change this to false
          body: >
            ## Download

            - [Windows](https://github.com/fosscord/fosscord-server/releases/download/v${{ steps.extract_version.outputs.version }}/fosscord-server-windows.exe)

            - [MacOS](https://github.com/fosscord/fosscord-server/releases/download/v${{ steps.extract_version.outputs.version }}/fosscord-server-macos.app.tgz)

            - [Linux](https://github.com/fosscord/fosscord-server/releases/download/v${{ steps.extract_version.outputs.version }}/fosscord-server-linux.tgz)

      - uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          upload_url: ${{ steps.create-release.outputs.upload_url }}
          asset_path: fosscord-server-windows.exe
          asset_name: fosscord-server-windows.exe
          asset_content_type: application/vnd.microsoft.portable-executable
      - uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          upload_url: ${{ steps.create-release.outputs.upload_url }}
          asset_path: fosscord-server-macos.app.tgz
          asset_name: fosscord-server-macos.app.tgz
          asset_content_type: application/gzip
      - uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          upload_url: ${{ steps.create-release.outputs.upload_url }}
          asset_path: fosscord-server-linux.tgz
          asset_name: fosscord-server-linux.tgz
          asset_content_type: application/gzip