1919 - " Artifact"
2020 - " Release"
2121
22- # # CONFIG ##############################################################################
2322jobs :
23+ # # CONFIG ##############################################################################
2424 job-config :
2525 runs-on : ubuntu-latest
2626 outputs :
@@ -175,48 +175,94 @@ jobs:
175175 key : ${{ github.sha }}-metadata
176176 path : ./metadata.7z
177177
178- - name : " 🚮 Dispose Cache"
178+ - name : " 🚮 Recycle Cache"
179179 uses : snnaplab/delete-branch-cache-action@v1
180180
181- - name : " 🚮 Dispose Temporal Artifacts"
181+ - name : " 🚮 Recycle Artifacts"
182182 uses : geekyeggo/delete-artifact@v2
183183 with :
184184 name : ' *'
185185
186- # - name: "📦 Create Package"
187- # run: |
188- # 7z e metadata.7z
189- # APP_VERSION=$(cat wsl2kernel.ps1 | grep -Po "^#.*v([\d\.\-]+)" | grep -Po "([\d\.\-]+)")
190-
191- - name : " 🔧 Prepare debug session"
192- if : github.event.inputs.debug_enabled == 'true'
186+ - name : " 📦 Create Package"
193187 run : |
194- ## install zsh
195- sudo apt install zsh zsh-syntax-highlighting
188+ 7z e metadata.7z
189+ APP_VERSION=$(cat wsl2kernel.ps1 | grep -Po "(?<=\sv)[\d\.\-]+")
190+ KERNEL_VERSION=$(jq .version -r kernels.json)
191+ BUILD_VERSION="${KERNEL_VERSION}-${APP_VERSION}"
192+ echo "BUILD_VERSION=${BUILD_VERSION}" >> $GITHUB_ENV
193+ find artifacts/ -name "WSL*" | while read f; do
194+ mv "$f" "${f}_${KERNEL_VERSION}"
195+ done
196+ mv artifacts/*/WSL* .
197+ ls -1 *.dif | sed "s|\..*||g" | while read c; do
198+ cp "artifacts/${c}/WSL2kernel_${c}" "WSL2kernel_${c}_${KERNEL_VERSION}"
199+ description=$(head -1 "${c}.dif" | sed "s|\r||")
200+ json=$(jq ".kernels |= . + [{ \"config\": \"${c}\",
201+ \"description\": \"${description}\" }]" kernels.json)
202+ echo $json > kernels.json
203+ done
204+ 7z a -aoa -tzip -- "WSL2kernel_${BUILD_VERSION}.zip" \
205+ *.ps1 \
206+ WSL2k* \
207+ LICENSE \
208+ README.md \
209+ kernels.json
210+ 7z l "WSL2kernel_${BUILD_VERSION}.zip"
196211
197- ## oh-my-posh
198- sudo wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/posh-linux-amd64 -O /usr/local/bin/oh-my-posh
199- sudo chmod +x /usr/local/bin/oh-my-posh
200212
201- ## setting rc files
202- echo "eval \"\$(oh-my-posh init \$(oh-my-posh get shell))\"" >> ~/.bashrc
203- echo "eval \"\$(oh-my-posh init \$(oh-my-posh get shell))\"" >> ~/.zshrc
204-
205- ## Default profiles
206- wget -q https://github.com/okibcn/miniU/raw/main/Github_Linux/.nanorc -O ~/.nanorc
207- wget -q https://github.com/okibcn/miniU/raw/main/Github_Linux/profile.sh -O ~/profile.sh
208- cp /etc/bash.bashrc ~
209- cat ~/profile.sh >> ~/bash.bashrc
210- sudo cp ~/bash.bashrc /etc/bash.bashrc -f
211- cp ~/profile.sh ~/.zshrc
213+ - name : " 👍 Upload Artifact"
214+ uses : actions/upload-artifact@v3
215+ if : env.CANCEL != 'true' && github.event.inputs.release == 'Artifact'
216+ with :
217+ name : ${{ env.BUILD_VERSION }}
218+ path : |
219+ *zip
220+ body.txt
221+ artifacts/*/src/.config
212222
213223
214- - name : " 🐞 Debug session"
215- uses : mxschmitt/action-tmate@v3
216- if : github.event.inputs.debug_enabled == 'true'
224+ - name : " 🎉 Publish a new release"
225+ uses : softprops/action-gh-release@v0.1.15
226+ # WARNING: before useing this action go to https://github.com/OWNER/REPO/settings/actions
227+ # and in **Workflow Permissions** section give actions **Read and Write permissions**.
228+ if : github.event_name != 'workflow_dispatch' || github.event.inputs.release == 'Release'
217229 env :
218- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
219- # # More info at https://til.simonwillison.net/github-actions/debug-tmate
220- # # or https://github.com/mxschmitt/action-tmate
230+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
231+ with :
232+ tag_name : ${{ env.VERSION }}
233+ body_path : body.txt
234+ files : |
235+ WSL2kernel_*
236+
237+ # - name: "🔧 Prepare debug session"
238+ # if: github.event.inputs.debug_enabled == 'true'
239+ # run: |
240+ # ## install zsh
241+ # sudo apt install zsh zsh-syntax-highlighting
242+
243+ # ## oh-my-posh
244+ # sudo wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/posh-linux-amd64 -O /usr/local/bin/oh-my-posh
245+ # sudo chmod +x /usr/local/bin/oh-my-posh
246+
247+ # ## setting rc files
248+ # echo "eval \"\$(oh-my-posh init \$(oh-my-posh get shell))\"" >> ~/.bashrc
249+ # echo "eval \"\$(oh-my-posh init \$(oh-my-posh get shell))\"" >> ~/.zshrc
250+
251+ # ## Default profiles
252+ # wget -q https://github.com/okibcn/miniU/raw/main/Github_Linux/.nanorc -O ~/.nanorc
253+ # wget -q https://github.com/okibcn/miniU/raw/main/Github_Linux/profile.sh -O ~/profile.sh
254+ # cp /etc/bash.bashrc ~
255+ # cat ~/profile.sh >> ~/bash.bashrc
256+ # sudo cp ~/bash.bashrc /etc/bash.bashrc -f
257+ # cp ~/profile.sh ~/.zshrc
258+
259+
260+ # - name: "🐞 Debug session"
261+ # uses: mxschmitt/action-tmate@v3
262+ # if: github.event.inputs.debug_enabled == 'true'
263+ # env:
264+ # GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
265+ # ## More info at https://til.simonwillison.net/github-actions/debug-tmate
266+ # ## or https://github.com/mxschmitt/action-tmate
221267
222268
0 commit comments