Skip to content

Commit

Permalink
Switch to shared dev-builds repo
Browse files Browse the repository at this point in the history
  • Loading branch information
sstephenson committed Jan 13, 2021
1 parent 1498db0 commit 178c817
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions .github/scripts/publish-dev-build
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#!/usr/bin/env bash
set -eux

DEV_BUILD_REPO_NAME="hotwired/dev-builds"
DEV_BUILD_ORIGIN_URL="https://${1}@github.com/${DEV_BUILD_REPO_NAME}.git"
BUILD_PATH="$HOME/publish-dev-build"

mkdir "$BUILD_PATH"

cd "$GITHUB_WORKSPACE"
package_name="$(jq -r .name package.json)"
package_files=( dist package.json )

origin_url="https://${1}:${1}@github.com/${GITHUB_REPOSITORY}.git"
tag="dev-builds/${GITHUB_SHA:0:7}"
tag="${package_name}/${GITHUB_SHA:0:7}"

name="$(git log -n 1 --format=format:%cn)"
email="$(git log -n 1 --format=format:%ce)"
Expand All @@ -22,7 +23,7 @@ cp -R "${package_files[@]}" "$BUILD_PATH"

cd "$BUILD_PATH"
git init .
git remote add origin "$origin_url"
git remote add origin "$DEV_BUILD_ORIGIN_URL"
git symbolic-ref HEAD refs/heads/publish-dev-build
git add "${package_files[@]}"

Expand All @@ -32,7 +33,7 @@ GIT_AUTHOR_EMAIL="$email" GIT_COMMITTER_EMAIL="$email" \
git commit -m "$message"

git tag "$tag"
[ "$GITHUB_REF" != "refs/heads/main" ] || git tag -f "dev-builds/latest"
[ "$GITHUB_REF" != "refs/heads/main" ] || git tag -f "${package_name}/latest"
git push -f --tags

echo done
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ jobs:
run: yarn test

- name: Publish dev build
run: .github/scripts/publish-dev-build '${{ secrets.GITHUB_TOKEN }}'
run: .github/scripts/publish-dev-build '${{ secrets.DEV_BUILD_GITHUB_TOKEN }}'
if: ${{ github.event_name == 'push' }}

0 comments on commit 178c817

Please sign in to comment.