diff --git a/.github/workflows/deploy-dev-to-beta.yml b/.github/workflows/deploy-dev-to-beta.yml new file mode 100644 index 0000000..512bf3f --- /dev/null +++ b/.github/workflows/deploy-dev-to-beta.yml @@ -0,0 +1,62 @@ +name: Deploy dev -> main:/beta + +on: + push: + branches: [ dev ] + workflow_dispatch: {} + +jobs: + build-and-publish: + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - name: Checkout dev + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.1' + + - name: Install bundler & dependencies + run: | + gem install bundler + bundle config set --local deployment 'true' + bundle install --jobs 4 --retry 3 + + - name: Build site (Jekyll) + run: bundle exec jekyll build --destination _site + + - name: Remove CNAME from build (prevent overriding custom domain) + run: rm -f _site/CNAME || true + + - name: Checkout main into separate folder + uses: actions/checkout@v4 + with: + repository: ${{ github.repository }} + ref: main + token: ${{ secrets.GITHUB_TOKEN }} + path: main-worktree + + - name: Copy built site into main-worktree/beta + run: | + rm -rf main-worktree/beta || true + mkdir -p main-worktree/beta + cp -a _site/. main-worktree/beta/ + + - name: Commit & push beta content to main + run: | + cd main-worktree + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add -A beta + git commit -m "Deploy dev -> beta: $GITHUB_SHA" || echo "No changes to commit" + # ensure push uses token auth (works around some permission/remote issues) + git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git + git push origin main + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index 3afc81b..aa4771a 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ _site/ .DS_Store Dockerfile /.vscode +/.history +/node_modules diff --git a/_includes/footer.html b/_includes/footer.html index d4abd12..ef57ac6 100644 --- a/_includes/footer.html +++ b/_includes/footer.html @@ -1,3 +1,3 @@ \ No newline at end of file diff --git a/_includes/links.html b/_includes/links.html index 5140380..b8a007d 100644 --- a/_includes/links.html +++ b/_includes/links.html @@ -1,11 +1,11 @@ -