forked from bcoe/conventional-release-labels
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: stub out initial implementation
- Loading branch information
0 parents
commit 553163e
Showing
14 changed files
with
7,685 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
name: ci | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node: [12, 14] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node }} | ||
- run: node --version | ||
# The first installation step ensures that all of our production | ||
# dependencies work on the given Node.js version, this helps us find | ||
# dependencies that don't match our engines field: | ||
- run: npm install --production --engine-strict --ignore-scripts --no-package-lock | ||
# Clean up the production install, before installing dev/production: | ||
- run: rm -rf node_modules | ||
- run: npm install | ||
- run: npm test | ||
windows: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 14 | ||
- run: npm install | ||
- run: npm test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
types: [ opened, edited ] | ||
name: conventional-release-labels | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: bcoe/conventional-release-labels |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
on: | ||
push: | ||
branches: | ||
- main | ||
name: release-please | ||
env: | ||
ACTION_NAME: conventional-release-labels | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: install | ||
run: npm ci | ||
- name: build | ||
run: npm run build | ||
- name: commit | ||
run: |- | ||
set -e | ||
# get current commit hash | ||
CURRENT_HASH=$(git rev-parse HEAD) | ||
# get last commit hash of last build dist | ||
LAST_BUILD_HASH=$(git log --author=google-github-actions-bot -1 --pretty=format:"%H") | ||
DIFF="" | ||
# build and commit dist if diff | ||
git config --global user.name "actions-bot" | ||
git config user.email '[email protected]' | ||
git add dist/ | ||
git diff-index --quiet HEAD || git commit -m "chore: build dist ${ACTION_NAME}" | ||
# if last commit hash of last build dist was found, get logs of commits in btw for PR body | ||
if [ -z "$LAST_BUILD_HASH" ] | ||
then | ||
echo "Unable to find last commit by bot, skipping diff gen" | ||
else | ||
DIFF=$(git log ${LAST_BUILD_HASH}...${CURRENT_HASH} --oneline) | ||
echo $DIFF | ||
fi | ||
# set env vars | ||
echo "CURRENT_HASH=${CURRENT_HASH}" >> $GITHUB_ENV | ||
echo "LAST_BUILD_HASH=${LAST_BUILD_HASH}" >> $GITHUB_ENV | ||
echo 'DIFF<<EOF' >> $GITHUB_ENV | ||
echo "${DIFF}" >> $GITHUB_ENV | ||
echo 'EOF' >> $GITHUB_ENV | ||
- name: Create PR with dist | ||
uses: peter-evans/create-pull-request@v3 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
commit-message: Build dist | ||
author: "actions-bot <[email protected]>" | ||
title: "chore: build dist" | ||
body: | | ||
Build dist PR | ||
${{env.DIFF}} | ||
labels: automated pr | ||
branch: create-pull-request/build-dist | ||
delete-branch: true | ||
push-to-fork: google-github-actions-bot/${{env.ACTION_NAME}} | ||
release-please-pr: | ||
runs-on: ubuntu-latest | ||
needs: [build] | ||
steps: | ||
- id: release-pr | ||
uses: GoogleCloudPlatform/release-please-action@main | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
release-type: node | ||
fork: true | ||
package-name: ${{env.ACTION_NAME}} | ||
command: release-pr | ||
- id: label | ||
if: ${{ steps.release-pr.outputs.pr }} | ||
uses: actions/github-script@v3 | ||
with: | ||
github-token: ${{secrets.GITHUB_TOKEN}} | ||
script: | | ||
const [owner, repo] = process.env.GITHUB_REPOSITORY.split('/'); | ||
await github.issues.addLabels({ | ||
owner, | ||
repo, | ||
issue_number: ${{steps.release-pr.outputs.pr}}, | ||
labels: ['autorelease: pending'] | ||
}); | ||
console.log(`Tagged ${{steps.release-pr.outputs.pr}}`) | ||
release-please-release: | ||
runs-on: ubuntu-latest | ||
needs: [build] | ||
steps: | ||
- uses: GoogleCloudPlatform/release-please-action@main | ||
id: release | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
release-type: node | ||
package-name: ${{env.ACTION_NAME}} | ||
command: github-release | ||
- uses: actions/checkout@v2 | ||
- name: tag major and patch versions | ||
run: | | ||
git config user.name github-actions[bot] | ||
git config user.email 41898282+github-actions[bot]@users.noreply.github.com | ||
git remote add gh-token "https://${{ secrets.GITHUB_TOKEN}}@github.com/google-github-actions/release-please-action.git" | ||
git tag -d v${{ steps.release.outputs.major }} || true | ||
git tag -d v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} || true | ||
git push origin :v${{ steps.release.outputs.major }} || true | ||
git push origin :v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} || true | ||
git tag -a v${{ steps.release.outputs.major }} -m "Release v${{ steps.release.outputs.major }}" | ||
git tag -a v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} -m "Release v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}" | ||
git push origin v${{ steps.release.outputs.major }} | ||
git push origin v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} | ||
if: ${{ steps.release.outputs.release_created }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
coverage | ||
node_modules | ||
.DS_Store |
Oops, something went wrong.