Cleanup Actions (#2088)

* chore: actions cleanup

* chore: make release messages more fun

* chore: fix casing

* chore(lint): Prettier fix

Co-authored-by: GitHub Action <github-action@users.noreply.github.com>
This commit is contained in:
Nate Moore 2021-12-02 14:04:11 -06:00 committed by GitHub
parent 3a8c9a6408
commit e0414ac865
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 10 deletions

View file

@ -64,7 +64,7 @@ jobs:
auto_fix: true auto_fix: true
git_name: GitHub Action git_name: GitHub Action
git_email: github-action@users.noreply.github.com git_email: github-action@users.noreply.github.com
commit_message: '[ci] ${linter} fix' commit_message: 'chore(lint): ${linter} fix'
github_token: ${{ secrets.GITHUB_TOKEN }} github_token: ${{ secrets.GITHUB_TOKEN }}
neutral_check_on_warning: true neutral_check_on_warning: true
@ -72,7 +72,6 @@ jobs:
# We upload all `dist/` artifacts to GitHub, which can be shared by all dependent jobs. # We upload all `dist/` artifacts to GitHub, which can be shared by all dependent jobs.
build: build:
name: Build Packages name: Build Packages
if: "!contains(github.event.head_commit.message, '[skip-ci]')"
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
@ -103,7 +102,6 @@ jobs:
# We also run `yarn install` with the `--prefer-offline` flag to speed things up. # We also run `yarn install` with the `--prefer-offline` flag to speed things up.
test: test:
name: 'Test: ${{ matrix.os }} (node@${{ matrix.node_version }})' name: 'Test: ${{ matrix.os }} (node@${{ matrix.node_version }})'
if: "!contains(github.event.head_commit.message, '[skip-ci]')"
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
@ -144,7 +142,6 @@ jobs:
smoke: smoke:
name: 'Smoke Test: ${{ matrix.target }}' name: 'Smoke Test: ${{ matrix.target }}'
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip-ci]')"
strategy: strategy:
matrix: matrix:
target: [docs, www] target: [docs, www]
@ -179,7 +176,7 @@ jobs:
# We download all `dist/` artifacts from GitHub to skip the build process. # We download all `dist/` artifacts from GitHub to skip the build process.
changelog: changelog:
name: Changelog PR or Release name: Changelog PR or Release
if: ${{ !contains(github.event.head_commit.message, '[skip-ci]') && github.ref_name == 'main' && github.repository_owner == 'withastro' }} if: ${{ github.ref_name == 'main' && github.repository_owner == 'withastro' }}
needs: [lint, test, smoke] needs: [lint, test, smoke]
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -209,7 +206,7 @@ jobs:
uses: changesets/action@v1 uses: changesets/action@v1
with: with:
publish: yarn changeset publish publish: yarn changeset publish
commit: '[ci] release' commit: 'chore: release'
title: '[ci] release' title: '[ci] release'
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View file

@ -16,7 +16,7 @@ concurrency:
jobs: jobs:
congrats: congrats:
name: congratsbot name: congratsbot
if: ${{ github.repository_owner == 'withastro' && !contains(github.event.head_commit.message, '[skip-ci]') }} if: ${{ github.repository_owner == 'withastro' }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- id: setup - id: setup

View file

@ -3,6 +3,27 @@ import { createRequire } from 'module';
const require = createRequire(import.meta.url); const require = createRequire(import.meta.url);
const baseUrl = new URL('https://github.com/withastro/astro/blob/main/'); const baseUrl = new URL('https://github.com/withastro/astro/blob/main/');
const emojis = ['🎉', '🥳', '🚀', '🧑‍🚀', '🎊', '🏆', '✅', '🤩', '🤖', '🙌'];
const descriptors = ['new releases', 'fresh new code', 'shiny updates', 'exciting stuff', 'package updates', 'awesome updates', 'bug fixes and features', 'updates'];
const verbs = [
'just went out!',
'now available!',
'in the wild!',
'now live!',
'hit the registry!',
'to share!',
'for you!',
"for y'all!",
"comin' your way!",
"comin' atcha!",
"comin' in hot!",
', freshly minted on the blockchain! (jk)',
];
function item(items) {
return items[Math.floor(Math.random() * items.length)];
}
async function run() { async function run() {
const releases = process.argv.slice(2)[0]; const releases = process.argv.slice(2)[0];
const data = JSON.parse(releases); const data = JSON.parse(releases);
@ -13,13 +34,17 @@ async function run() {
}) })
); );
const emoji = item(emojis);
const descriptor = item(descriptors);
const verb = item(verbs);
if (packages.length === 1) { if (packages.length === 1) {
const { name, version, url } = packages[0]; const { name, version, url } = packages[0];
console.log(`\`${name}@${version}\` was just released! Read the [release notes →](<${url}>)`); console.log(`${emoji} \`${name}@${version}\` ${verb}\nRead the [release notes →](<${url}>)`);
} else { } else {
console.log(`**Some new releases just went out!**\n`); console.log(`${emoji} Some ${descriptor} ${verb}\n`);
for (const { name, version, url } of packages) { for (const { name, version, url } of packages) {
console.log(` \`${name}@${version}\` ([Release Notes →](<${url}>))`); console.log(`\`${name}@${version}\` Read the [release notes →](<${url}>)`);
} }
} }
} }