Bump protobufjs and @devvit/public-api (#67) #132
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
name: Generate development build | |
# Don't generate builds for other builds! | |
on: | |
push: | |
branches-ignore: | |
- "builds/**" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Install dependencies | |
run: | | |
npm ci | |
- name: Build Typescript | |
run: | | |
npm run build | |
- name: Push build artifacts | |
if: false | |
env: | |
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }} | |
run: | | |
# Find current branch name from GITHUB_REF and prepend 'builds/'' | |
BUILDS_BRANCH_NAME="builds/${GITHUB_REF#refs/heads/}" | |
echo "Pushing artifacts to branch $BUILDS_BRANCH_NAME" | |
# Create another clone of the repository in a temporary directory | |
git clone "$(git remote get-url origin)" .temp | |
cd .temp | |
# Checkout the builds branch, or create one if it doesn't exist yet | |
git checkout "$BUILDS_BRANCH_NAME" || git checkout --orphan "$BUILDS_BRANCH_NAME" | |
# When creating a new branch, the whole working directory is added by | |
# default, but we don't want that | |
git reset | |
# We also have to pull changes from the remote if possible | |
git pull || true | |
# Move build artifacts and metadata into this new directory, including | |
# files always included in npm packages per | |
# https://docs.npmjs.com/files/package.json#files | |
cp -r ../dist . | |
cp ../package.json . | |
cp ../LICENSE . | |
cp ../README.md . | |
# If we have changes... | |
if [ -n "$(git status --porcelain)" ]; then | |
# Add files to git | |
git add -f dist/** package.json LICENSE README.md | |
# Commit | |
git config user.name "Build Bot" | |
git config user.email "bot@github-actions" | |
git commit -m "Build of ${GITHUB_SHA:0:7}" | |
# Convert remote URL from HTTPS to SSH format so we can use our key | |
git remote set-url origin "$(git remote get-url origin | sed 's#http.*com/#[email protected]:#g')" | |
# Push the commit to the origin | |
eval `ssh-agent -t 60 -s` | |
echo "$DEPLOY_KEY" | ssh-add - | |
mkdir -p ~/.ssh/ | |
ssh-keyscan github.com >> ~/.ssh/known_hosts | |
git push || git push --set-upstream origin "$BUILDS_BRANCH_NAME" | |
ssh-agent -k | |
else | |
echo "No changes to build output detected" | |
fi |