summary refs log tree commit diff
path: root/.github/workflows/release.yml
blob: 6a32d29d96197f458c5b8a501d5342c3574bf3c4 (plain)
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
name: Produce release
on: [workflow_dispatch]

concurrency:
  group: ${{ github.ref }}-release
  cancel-in-progress: true

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      # Download resources
      - name: Retrieve classicube texture pack
        run: |
          wget https://www.classicube.net/static/default.zip
      - name: Retrieve classicube audio pack
        run: |
          wget https://www.classicube.net/static/audio.zip
          
      # Download windows artifacts
      - name: Retrieve Windows binaries
        run: |
          wget https://cdn.classicube.net/client/latest/ClassiCube.64.exe -O cc-w64.exe
          wget https://cdn.classicube.net/client/latest/ClassiCube.exe -O cc-w32.exe
          
      # Download Linux artifacts
      - name: Retrieve Linux binaries
        run: |
          wget https://cdn.classicube.net/client/latest/ClassiCube -O cc-linux-64
          wget https://cdn.classicube.net/client/latest/ClassiCube.32 -O cc-linux-32
          
      # Download macOS artifacts
      - name: Retrieve macOS binaries
        run: |
          wget https://cdn.classicube.net/client/latest/ClassiCube.64.osx -O cc-mac-64
          wget https://cdn.classicube.net/client/latest/ClassiCube.osx -O cc-mac-32
          
      # Download RPI artifacts
      - name: Retrieve RPI binaries
        run: |
          wget https://cdn.classicube.net/client/latest/cc-rpi64 -O cc-rpi-64
          wget https://cdn.classicube.net/client/latest/ClassiCube.rpi -O cc-rpi-32
          
      # Download FreeBSD artifacts
      - name: Retrieve macOS binaries
        run: |
          wget https://cdn.classicube.net/client/latest/cc-freebsd-64 -O cc-freebsd-64
          wget https://cdn.classicube.net/client/latest/cc-freebsd-32 -O cc-freebsd-32
          
      - name: Generate builds
        id: compile
        shell: bash
        run: |
          mkdir ClassiCube
          mkdir ClassiCube/audio
          mkdir ClassiCube/texpacks
          cp audio.zip ClassiCube/audio/classicube.zip
          cp default.zip ClassiCube/texpacks/classicube.zip
          
          # ./ClassiCube
          make_unix_tar() {
            cp $2 ClassiCube/ClassiCube
            chmod +x ClassiCube/ClassiCube
            tar -zcvf $1 ClassiCube
            rm ClassiCube/ClassiCube
          }
           
          # ./ClassiCube
          make_windows_zip() {
            cp $2 ClassiCube/ClassiCube.exe
            zip -r $1 ClassiCube
            rm ClassiCube/ClassiCube.exe
          }
          
          # Generate FreeBSD builds
          make_unix_tar cc-freebsd32.tar.gz cc-freebsd-32
          make_unix_tar cc-freebsd64.tar.gz cc-freebsd-64
          
          # Generate RPI builds
          make_unix_tar cc-rpi32.tar.gz cc-rpi-32
          make_unix_tar cc-rpi64.tar.gz cc-rpi-64
          
          # Generate Linux builds
          make_unix_tar cc-linux32.tar.gz cc-linux-32
          make_unix_tar cc-linux64.tar.gz cc-linux-64
          
          # Generate macOS builds
          make_unix_tar cc-mac32.tar.gz cc-mac-32
          make_unix_tar cc-mac64.tar.gz cc-mac-64
          
          # Generate Windows builds
          make_windows_zip cc-win32.zip cc-w32.exe
          make_windows_zip cc-win64.zip cc-w64.exe


      - uses: ./.github/actions/notify_failure
        if: ${{ always() && steps.compile.outcome == 'failure' }}
        with:
          NOTIFY_MESSAGE: 'Failed to produce release'
          WEBHOOK_URL: '${{ secrets.WEBHOOK_URL }}'
          
        
      # Generate Linux release files
      - uses: ./.github/actions/upload_build
        if: ${{ always() && steps.compile.outcome == 'success' }}
        with:
          SOURCE_FILE: 'cc-linux32.tar.gz'
          DEST_NAME: 'cc-linux32.tar.gz'
          
      - uses: ./.github/actions/upload_build
        if: ${{ always() && steps.compile.outcome == 'success' }}
        with:
          SOURCE_FILE: 'cc-linux64.tar.gz'
          DEST_NAME: 'cc-linux64.tar.gz'
          
          
      # Generate macOS release files
      - uses: ./.github/actions/upload_build
        if: ${{ always() && steps.compile.outcome == 'success' }}
        with:
          SOURCE_FILE: 'cc-mac32.tar.gz'
          DEST_NAME: 'cc-mac32.tar.gz'
          
      - uses: ./.github/actions/upload_build
        if: ${{ always() && steps.compile.outcome == 'success' }}
        with:
          SOURCE_FILE: 'cc-mac64.tar.gz'
          DEST_NAME: 'cc-mac64.tar.gz'
          
          
      # Generate Windows release files
      - uses: ./.github/actions/upload_build
        if: ${{ always() && steps.compile.outcome == 'success' }}
        with:
          SOURCE_FILE: 'cc-win32.zip'
          DEST_NAME: 'cc-win32.zip'
          
      - uses: ./.github/actions/upload_build
        if: ${{ always() && steps.compile.outcome == 'success' }}
        with:
          SOURCE_FILE: 'cc-win64.zip'
          DEST_NAME: 'cc-win64.zip'
          
          
      # Generate RPI release files
      - uses: ./.github/actions/upload_build
        if: ${{ always() && steps.compile.outcome == 'success' }}
        with:
          SOURCE_FILE: 'cc-rpi32.tar.gz'
          DEST_NAME: 'cc-rpi32.tar.gz'
          
      - uses: ./.github/actions/upload_build
        if: ${{ always() && steps.compile.outcome == 'success' }}
        with:
          SOURCE_FILE: 'cc-rpi64.tar.gz'
          DEST_NAME: 'cc-rpi64.tar.gz'
          
          
      # Generate FreeBSD release files
      - uses: ./.github/actions/upload_build
        if: ${{ always() && steps.compile.outcome == 'success' }}
        with:
          SOURCE_FILE: 'cc-freebsd32.tar.gz'
          DEST_NAME: 'cc-freebsd32.tar.gz'
          
      - uses: ./.github/actions/upload_build
        if: ${{ always() && steps.compile.outcome == 'success' }}
        with:
          SOURCE_FILE: 'cc-freebsd64.tar.gz'
          DEST_NAME: 'cc-freebsd64.tar.gz'
          
          
      - uses: ./.github/actions/notify_success
        if: ${{ always() && steps.compile.outcome == 'success' }}
        with:
          DESTINATION_URL: '${{ secrets.NOTIFY_URL }}'
          WORKFLOW_NAME: 'release'