-
Notifications
You must be signed in to change notification settings - Fork 20
75 lines (67 loc) · 2.53 KB
/
Release.yml
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
# Copyright (c) 2023 okibcn
# This is free software, licensed under the GNU General Public License v3.0
# See /LICENSE for more information.
# https://github.com/okibcn/wslcompact
# Description: Prepares package and releases it.
name: Release
on:
# schedule:
# - cron: '52 0 * * *'
# runs at 0:52 UTC every day
workflow_dispatch:
inputs:
debug_enabled:
description: 'Run the build with tmate debugging enabled true/false (default: false)'
required: false
default: 'false'
release:
description: 'Type (yes) for release, (no) will generate an artifact (default: no)'
required: false
default: 'no'
jobs:
build:
runs-on: ubuntu-latest
# Use the Bash shell regardless whether the GitHub Actions runner is ubuntu-latest, macos-latest, or windows-latest
defaults:
run:
shell: bash
steps:
- name: "⏬ Checkout repository"
uses: actions/checkout@v3
- name: "🐞 Debug session"
uses: mxschmitt/action-tmate@v3
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled == 'true'
## More info at https://til.simonwillison.net/github-actions/debug-tmate
## or https://github.com/mxschmitt/action-tmate
- name: "📦 Create Package"
run: |
############################
## ##
## CREATE PACKAGE ##
## ##
############################
cp LICENSE README* -t WslCompact
VERSION=$(cat WslCompact/WslCompact.psm1 | grep -Po "^#.*v([\d\.\-]+)" | grep -Po "([\d\.\-]+)")
zip "./WslCompact-v$VERSION.zip" WslCompact/*
echo "VERSION=${VERSION}" >>$GITHUB_ENV
- name: "👍 Upload Artifact"
uses: actions/upload-artifact@v3
if: github.event_name == 'workflow_dispatch' && github.event.inputs.release != 'yes'
with:
name: ${{ env.VERSION }}
path: |
*.zip
- name: "🎉 Publish a new release"
uses: softprops/action-gh-release@v0.1.15
# go to https://github.com/OWNER/REPO/settings/actions and
# in "**"Workflow Permissions" section give actions **Read and Write permissions**.
if: github.event_name != 'workflow_dispatch' || github.event.inputs.release == 'yes'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.VERSION }}
files: ./*.zip
# body: |
# ${{ env.BODY }}