mirror of
https://github.com/joaquinjsb/gitea-release-please-action
synced 2026-05-12 22:11:35 +02:00
chore: PR workflow for building dist (#94)
This commit is contained in:
48
.github/workflows/release-please.yaml
vendored
48
.github/workflows/release-please.yaml
vendored
@@ -5,6 +5,8 @@ on:
|
|||||||
name: release-please
|
name: release-please
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
env:
|
||||||
|
ACTION_NAME: release-please-action
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
@@ -14,21 +16,55 @@ jobs:
|
|||||||
run: npm run build
|
run: npm run build
|
||||||
- name: commit
|
- name: commit
|
||||||
run: |-
|
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 --global user.name "actions-bot"
|
||||||
|
git config user.email 'github-actions-bot@google.com'
|
||||||
git add dist/
|
git add dist/
|
||||||
git diff-index --quiet HEAD || git commit -m "chore: build dist"
|
git diff-index --quiet HEAD || git commit -m "chore: build dist ${ACTION_NAME}"
|
||||||
git pull --rebase
|
# if last commit hash of last build dist was found, get logs of commits in btw for PR body
|
||||||
git push origin main
|
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.ACTIONS_BOT_TOKEN }}
|
||||||
|
commit-message: Build dist
|
||||||
|
author: "actions-bot <github-actions-bot@google.com>"
|
||||||
|
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:
|
release-please-pr:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [build]
|
needs: [build]
|
||||||
steps:
|
steps:
|
||||||
- uses: GoogleCloudPlatform/release-please-action@v2.5.7
|
- uses: GoogleCloudPlatform/release-please-action@v2.5.7
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.RELEASE_PR_TOKEN }}
|
token: ${{ secrets.ACTIONS_BOT_TOKEN }}
|
||||||
release-type: node
|
release-type: node
|
||||||
fork: true
|
fork: true
|
||||||
package-name: release-please-action
|
package-name: ${{env.ACTION_NAME}}
|
||||||
command: release-pr
|
command: release-pr
|
||||||
release-please-release:
|
release-please-release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -38,5 +74,5 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
release-type: node
|
release-type: node
|
||||||
package-name: release-please-action
|
package-name: ${{env.ACTION_NAME}}
|
||||||
command: github-release
|
command: github-release
|
||||||
|
|||||||
Reference in New Issue
Block a user