Format actions and make empty-changelog add version number in commit message

This commit is contained in:
Send_Nukez 2021-10-29 22:53:04 +02:00
parent f24015e3c5
commit 3014fa68a9
4 changed files with 85 additions and 94 deletions

View file

@ -9,26 +9,20 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
ref: ${{ github.event.repository.default_branch }} ref: ${{ github.event.repository.default_branch }}
fetch-depth: 0
- name: Empty CHANGELOG.md - name: Empty CHANGELOG.md
run: | run: |
git config --global user.email "action@github.com" git config --global user.email "action@github.com"
git config --global user.name "github-actions" git config --global user.name "github-actions"
if [ -s CHANGELOG.md ]; then rm CHANGELOG.md
echo "Comitting emptied CHANGELOG.md" touch CHANGELOG.md
else
echo "CHANGELOG.md is already empty. skipping comitting"
exit 0
fi
rm CHANGELOG.md git add CHANGELOG.md
touch CHANGELOG.md git commit --allow-empty -m "Empty CHANGELOG.md after v$(git describe --tags --abbrev=0)"
git push
git add CHANGELOG.md
git commit -m "Empty CHANGELOG.md"
git push

View file

@ -4,23 +4,21 @@ on:
pull_request: pull_request:
push: push:
branches: branches:
- main - main
jobs: jobs:
prettier: prettier:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
# Make sure the actual branch is checked out when running on pull requests ref: ${{ github.head_ref }}
ref: ${{ github.head_ref }} fetch-depth: 0
# This is important to fetch the changes to the previous commit
fetch-depth: 0
- name: Prettify code - name: Prettify code
uses: creyD/prettier_action@v4.0 uses: creyD/prettier_action@v4.0
with: with:
prettier_options: --write **/*.{js,css} prettier_options: --write **/*.{js,css}
same_commit: True same_commit: True

View file

@ -4,7 +4,7 @@ on:
workflow_dispatch: workflow_dispatch:
inputs: inputs:
version: version:
description: 'Version of Release (format: X.X.X)' description: "Version of Release (format: X.X.X)"
required: true required: true
jobs: jobs:
@ -12,67 +12,67 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Verify Input - name: Verify Input
run: | run: |
[[ "${{ github.event.inputs.version }}" =~ ^[0-9]\.[0-9]\.[0-9]$ ]] && echo "Matches" && exit 0 || echo "Use versions like '1.2.3'" && exit 1 [[ "${{ github.event.inputs.version }}" =~ ^[0-9]\.[0-9]\.[0-9]$ ]] && echo "Matches" && exit 0 || echo "Use versions like '1.2.3'" && exit 1
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
ref: ${{ github.head_ref }} ref: ${{ github.head_ref }}
fetch-depth: 0 fetch-depth: 0
- name: Setup Node.js - name: Setup Node.js
uses: actions/setup-node@v2 uses: actions/setup-node@v2
with: with:
node-version: '14' node-version: "14"
- name: Build Webpack - name: Build Webpack
run: | run: |
npm install npm install
npm run build npm run build
echo "${{ github.event.inputs.version }}" > dist/VERSION echo "${{ github.event.inputs.version }}" > dist/VERSION
env: env:
DRIBBBLISH_VERSION: ${{ github.event.inputs.version }} DRIBBBLISH_VERSION: ${{ github.event.inputs.version }}
- name: Zip Release - name: Zip Release
working-directory: dist working-directory: dist
run: | run: |
sudo apt-get install zip sudo apt-get install zip
zip -r DribbblishDynamic_v${{ github.event.inputs.version }}.zip * zip -r DribbblishDynamic_v${{ github.event.inputs.version }}.zip *
mv DribbblishDynamic_v${{ github.event.inputs.version }}.zip .. mv DribbblishDynamic_v${{ github.event.inputs.version }}.zip ..
- name: Read CHANGELOG.md and get latest Tag - name: Read CHANGELOG.md and get latest Tag
run: | run: |
[ -s CHANGELOG.md ] && CHANGELOG=$(< CHANGELOG.md) || CHANGELOG="*Empty.*" [ -s CHANGELOG.md ] && CHANGELOG=$(< CHANGELOG.md) || CHANGELOG="*Empty.*"
echo "CHANGELOG<<EOF" >> $GITHUB_ENV echo "CHANGELOG<<EOF" >> $GITHUB_ENV
echo "$CHANGELOG" >> $GITHUB_ENV echo "$CHANGELOG" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV echo "EOF" >> $GITHUB_ENV
echo "LATEST_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV echo "LATEST_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
- name: Upload Release - name: Upload Release
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v1
with: with:
fail_on_unmatched_files : true fail_on_unmatched_files: true
files: DribbblishDynamic_v${{ github.event.inputs.version }}.zip files: DribbblishDynamic_v${{ github.event.inputs.version }}.zip
tag_name: ${{ github.event.inputs.version }} tag_name: ${{ github.event.inputs.version }}
draft: true draft: true
name: v${{ github.event.inputs.version }} name: v${{ github.event.inputs.version }}
body: | body: |
## Changelog ## Changelog
${{ env.CHANGELOG }} ${{ env.CHANGELOG }}
Full changelog [here](https://github.com/JulienMaille/dribbblish-dynamic-theme/compare/${{ env.LATEST_TAG }}...${{ github.event.inputs.version }}) Full changelog [here](https://github.com/JulienMaille/dribbblish-dynamic-theme/compare/${{ env.LATEST_TAG }}...${{ github.event.inputs.version }})
--- ---
### Install / Update ### Install / Update
#### Windows (PowerShell) #### Windows (PowerShell)
```powershell ```powershell
Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/JulienMaille/dribbblish-dynamic-theme/master/install.ps1" | Invoke-Expression Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/JulienMaille/dribbblish-dynamic-theme/master/install.ps1" | Invoke-Expression
``` ```
#### Linux/MacOS (Bash) #### Linux/MacOS (Bash)
```bash ```bash
curl -fsSL https://raw.githubusercontent.com/JulienMaille/dribbblish-dynamic-theme/master/install.sh | sh curl -fsSL https://raw.githubusercontent.com/JulienMaille/dribbblish-dynamic-theme/master/install.sh | sh
``` ```

View file

@ -1,2 +1 @@
Vibrant.min.js .github/
dist/