Skip to content

Commit

Permalink
Merge branch 'main' into feat/add-puppeteer-file-icons
Browse files Browse the repository at this point in the history
  • Loading branch information
PKief committed Nov 15, 2023
2 parents 6a42e97 + a986c16 commit 39f1843
Show file tree
Hide file tree
Showing 7 changed files with 144 additions and 3 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,21 @@ jobs:

steps:
- name: Checkout πŸ›Ž
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Node.js ${{ matrix.node-version }} βš™
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Run display server πŸ–₯
run: /usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & echo "Started xvfb"
shell: bash
if: ${{ success() && matrix.os == 'ubuntu-latest' }}

- name: Install node_modules πŸ“¦
run: npm ci

- name: Cache node_modules πŸ’Ύ
uses: actions/cache@v3
env:
Expand All @@ -37,6 +41,7 @@ jobs:
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Test + Build πŸš€
run: |
npm test
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/color-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ jobs:
TARGET_BRANCH: ${{ github.event.pull_request.base.ref }}
steps:
- name: Checkout πŸ›ŽοΈ
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Check colors 🎨
run: |
svgFiles=$(git diff origin/${{ env.TARGET_BRANCH }} --diff-filter=ACMRTUX --name-only | grep '.svg$')
Expand Down
64 changes: 64 additions & 0 deletions .github/workflows/icon-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Icon Review

permissions:
contents: write

on:
pull_request:
paths:
- 'icons/*.svg'

jobs:
icon-review:
name: Icon Review
runs-on: ubuntu-latest
env:
TARGET_BRANCH: ${{ github.event.pull_request.base.ref }}
steps:
- name: Checkout πŸ›ŽοΈ
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Review SVG files πŸ”
run: |
svgFiles=$(git diff origin/${{ env.TARGET_BRANCH }} --diff-filter=ACMRTUX --name-only | grep '.svg$')
echo "SVG files changed: ${svgFiles}"
npx svg-icon-review ${svgFiles}
- name: Upload PNG to Repository ⬆️
run: |
mkdir -p review-images
mv ./preview.png review-images/${{ github.event.pull_request.number }}_${{ github.sha }}.png
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
git fetch origin
git checkout -b review-images origin/review-images --no-track
git add review-images/
git commit -m "Add generated review image"
git push -u origin review-images
- name: Post review in PR ✍️
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const pngFilePath = './preview.png';
const commentBody = `
## Preview
Thank you for creating a pull request. This preview shows you how your changes will look on the different themes:
![Generated Preview](https://raw.githubusercontent.com/' + context.repo.owner + '/' + context.repo.repo + '/' + 'review-images/review-images/${{ github.event.pull_request.number }}_${{ github.sha }}.png)
You can find more information how to contribute in the [contribution guidelines](https://github.com/PKief/vscode-material-icon-theme/blob/main/CONTRIBUTING.md).
`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: commentBody
})
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59 changes: 59 additions & 0 deletions .github/workflows/pr-closed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: PR closed

on:
pull_request:
types:
- closed

jobs:
cleanup:
runs-on: ubuntu-latest
steps:
- name: Checkout review-images branch πŸ›ŽοΈ
uses: actions/checkout@v4
with:
ref: review-images

- name: Delete PR related files πŸ—‘οΈ
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const path = require('path');
const dir = './review-images';
const prNumber = context.payload.pull_request.number;
fs.readdirSync(dir).forEach(file => {
if (file.startsWith(`${prNumber}_`)) {
fs.unlinkSync(path.join(dir, file));
}
});
- name: Commit changes ⬆️
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add -A
if [[ $(git diff --stat --staged) != '' ]]; then
git commit -m "Delete files related to PR #${{ github.event.pull_request.number }}"
git push
fi
thank_you:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
steps:
- name: Post Thank You Comment πŸ™
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `## Merge Successful
Thanks for your contribution! πŸŽ‰
The changes will be part of the upcoming update on the marketplace.`
})
12 changes: 11 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,28 @@ jobs:
VERSION_CHANGE: ${{ github.event.inputs.versionChange }}
steps:
- name: Checkout πŸ›ŽοΈ
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Node.js βš™οΈ
uses: actions/setup-node@v3
with:
node-version: 'lts/*'
registry-url: 'https://registry.npmjs.org'

- name: Install node_modules πŸ“¦
run: |
npm ci
npm install --global @vscode/vsce
- name: Update version β†—
run: |
git config --global user.name 'Philipp Kief'
git config --global user.email 'PKief@users.noreply.github.com'
git config --global push.followTags true
npm version ${{ env.VERSION_CHANGE }} -m "Release %s"
- name: Get meta data πŸ”
run: |
NODE_VERSION=$(node -p -e "require('./package.json').version")
Expand All @@ -45,28 +49,34 @@ jobs:
echo NAME=$NODE_NAME >> $GITHUB_ENV
NODE_DISPLAY_NAME=$(node -p -e "require('./package.json').displayName")
echo DISPLAY_NAME=$NODE_DISPLAY_NAME >> $GITHUB_ENV
- name: Build βš’οΈ
run: vsce package

- name: Push tags πŸ“Œ
run: git push

- name: Release ${{ env.VERSION }} πŸ”†
uses: softprops/action-gh-release@v1
with:
files: ${{ env.NAME }}-${{ env.VERSION }}.vsix
tag_name: v${{ env.VERSION }}
name: ${{ env.DISPLAY_NAME }} v${{ env.VERSION }}
generate_release_notes: true

- name: Publish to Open VSX Registry 🌐
uses: HaaLeo/publish-vscode-extension@v1
with:
pat: ${{ secrets.OPEN_VSX_TOKEN }}
extensionFile: ${{ env.NAME }}-${{ env.VERSION }}.vsix

- name: Publish to Visual Studio Marketplace 🌐
uses: HaaLeo/publish-vscode-extension@v1
with:
pat: ${{ secrets.VS_MARKETPLACE_TOKEN }}
registryUrl: https://marketplace.visualstudio.com
extensionFile: ${{ env.NAME }}-${{ env.VERSION }}.vsix

- name: Publish to NPM Registry 🌐
run: npm publish
env:
Expand Down
1 change: 1 addition & 0 deletions icons/apps-script.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/icons/fileIcons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2476,5 +2476,6 @@ export const fileIcons: FileIcons = {
'puppeteer.config.cjs',
],
},
{ name: 'apps-script', fileExtensions: ['gs'] },
],
};

0 comments on commit 39f1843

Please sign in to comment.