From 3014fa68a9b7f63ce26d2fd0333852f1bbc66dc8 Mon Sep 17 00:00:00 2001 From: Send_Nukez Date: Fri, 29 Oct 2021 22:53:04 +0200 Subject: [PATCH] Format actions and make `empty-changelog` add version number in commit message --- .github/workflows/empty-changelog.yaml | 38 ++++----- .github/workflows/prettier.yml | 26 +++--- .github/workflows/release.yaml | 112 ++++++++++++------------- .prettierignore | 3 +- 4 files changed, 85 insertions(+), 94 deletions(-) diff --git a/.github/workflows/empty-changelog.yaml b/.github/workflows/empty-changelog.yaml index 5f9a534..82d8b00 100644 --- a/.github/workflows/empty-changelog.yaml +++ b/.github/workflows/empty-changelog.yaml @@ -1,6 +1,6 @@ name: Empty CHANGELOG.md -on: +on: release: types: [published] @@ -9,26 +9,20 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v2 - with: - ref: ${{ github.event.repository.default_branch }} - - - name: Empty CHANGELOG.md - run: | - git config --global user.email "action@github.com" - git config --global user.name "github-actions" - - if [ -s CHANGELOG.md ]; then - echo "Comitting emptied CHANGELOG.md" - else - echo "CHANGELOG.md is already empty. skipping comitting" - exit 0 - fi + - name: Checkout + uses: actions/checkout@v2 + with: + ref: ${{ github.event.repository.default_branch }} + fetch-depth: 0 - rm CHANGELOG.md - touch CHANGELOG.md + - name: Empty CHANGELOG.md + run: | + git config --global user.email "action@github.com" + git config --global user.name "github-actions" - git add CHANGELOG.md - git commit -m "Empty CHANGELOG.md" - git push \ No newline at end of file + rm CHANGELOG.md + touch CHANGELOG.md + + git add CHANGELOG.md + git commit --allow-empty -m "Empty CHANGELOG.md after v$(git describe --tags --abbrev=0)" + git push diff --git a/.github/workflows/prettier.yml b/.github/workflows/prettier.yml index 04cc61a..7e7bb8c 100644 --- a/.github/workflows/prettier.yml +++ b/.github/workflows/prettier.yml @@ -1,26 +1,24 @@ name: Prettier -on: +on: pull_request: push: branches: - - main + - main jobs: prettier: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v2 - with: - # Make sure the actual branch is checked out when running on pull requests - ref: ${{ github.head_ref }} - # This is important to fetch the changes to the previous commit - fetch-depth: 0 + - name: Checkout + uses: actions/checkout@v2 + with: + ref: ${{ github.head_ref }} + fetch-depth: 0 - - name: Prettify code - uses: creyD/prettier_action@v4.0 - with: - prettier_options: --write **/*.{js,css} - same_commit: True \ No newline at end of file + - name: Prettify code + uses: creyD/prettier_action@v4.0 + with: + prettier_options: --write **/*.{js,css} + same_commit: True diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 6cc62e1..b9953bd 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,10 +1,10 @@ name: Release -on: +on: workflow_dispatch: inputs: version: - description: 'Version of Release (format: X.X.X)' + description: "Version of Release (format: X.X.X)" required: true jobs: @@ -12,67 +12,67 @@ jobs: runs-on: ubuntu-latest steps: - - name: Verify Input - run: | - [[ "${{ github.event.inputs.version }}" =~ ^[0-9]\.[0-9]\.[0-9]$ ]] && echo "Matches" && exit 0 || echo "Use versions like '1.2.3'" && exit 1 + - name: Verify Input + run: | + [[ "${{ 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 - uses: actions/checkout@v2 - with: - ref: ${{ github.head_ref }} - fetch-depth: 0 + - name: Checkout + uses: actions/checkout@v2 + with: + ref: ${{ github.head_ref }} + fetch-depth: 0 - - name: Setup Node.js - uses: actions/setup-node@v2 - with: - node-version: '14' + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: "14" - - name: Build Webpack - run: | - npm install - npm run build - echo "${{ github.event.inputs.version }}" > dist/VERSION - env: - DRIBBBLISH_VERSION: ${{ github.event.inputs.version }} + - name: Build Webpack + run: | + npm install + npm run build + echo "${{ github.event.inputs.version }}" > dist/VERSION + env: + DRIBBBLISH_VERSION: ${{ github.event.inputs.version }} - - name: Zip Release - working-directory: dist - run: | - sudo apt-get install zip - zip -r DribbblishDynamic_v${{ github.event.inputs.version }}.zip * - mv DribbblishDynamic_v${{ github.event.inputs.version }}.zip .. + - name: Zip Release + working-directory: dist + run: | + sudo apt-get install zip + zip -r DribbblishDynamic_v${{ github.event.inputs.version }}.zip * + mv DribbblishDynamic_v${{ github.event.inputs.version }}.zip .. - - name: Read CHANGELOG.md and get latest Tag - run: | - [ -s CHANGELOG.md ] && CHANGELOG=$(< CHANGELOG.md) || CHANGELOG="*Empty.*" + - name: Read CHANGELOG.md and get latest Tag + run: | + [ -s CHANGELOG.md ] && CHANGELOG=$(< CHANGELOG.md) || CHANGELOG="*Empty.*" - echo "CHANGELOG<> $GITHUB_ENV - echo "$CHANGELOG" >> $GITHUB_ENV - echo "EOF" >> $GITHUB_ENV + echo "CHANGELOG<> $GITHUB_ENV + echo "$CHANGELOG" >> $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 - uses: softprops/action-gh-release@v1 - with: - fail_on_unmatched_files : true - files: DribbblishDynamic_v${{ github.event.inputs.version }}.zip - tag_name: ${{ github.event.inputs.version }} - draft: true - name: v${{ github.event.inputs.version }} - body: | - ## Changelog - ${{ env.CHANGELOG }} + - name: Upload Release + uses: softprops/action-gh-release@v1 + with: + fail_on_unmatched_files: true + files: DribbblishDynamic_v${{ github.event.inputs.version }}.zip + tag_name: ${{ github.event.inputs.version }} + draft: true + name: v${{ github.event.inputs.version }} + body: | + ## 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 - #### Windows (PowerShell) - ```powershell - Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/JulienMaille/dribbblish-dynamic-theme/master/install.ps1" | Invoke-Expression - ``` - #### Linux/MacOS (Bash) - ```bash - curl -fsSL https://raw.githubusercontent.com/JulienMaille/dribbblish-dynamic-theme/master/install.sh | sh - ``` \ No newline at end of file + --- + ### Install / Update + #### Windows (PowerShell) + ```powershell + Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/JulienMaille/dribbblish-dynamic-theme/master/install.ps1" | Invoke-Expression + ``` + #### Linux/MacOS (Bash) + ```bash + curl -fsSL https://raw.githubusercontent.com/JulienMaille/dribbblish-dynamic-theme/master/install.sh | sh + ``` diff --git a/.prettierignore b/.prettierignore index 2549d26..6d2eaaa 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,2 +1 @@ -Vibrant.min.js -dist/ \ No newline at end of file +.github/ \ No newline at end of file