Revert previous change #7
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: Deploy Website | |
on: | |
# Runs on pushes targeting the default branch | |
push: | |
branches: ["main"] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# Allow one concurrent deployment | |
concurrency: | |
group: "publish" | |
cancel-in-progress: true | |
env: | |
WEBSITE_SOURCES_DIR: sources | |
WEBSITE_CONTENT_DIR: result | |
WEBSITE_CONTENT_REPO: eclipse-sirius/sirius-website | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout templates | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.GITHUB_TOKEN }} | |
path: ${{ env.WEBSITE_SOURCES_DIR }} | |
- name: Checkout content website | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
repository: ${{ env.WEBSITE_CONTENT_REPO }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
path: ${{ env.WEBSITE_CONTENT_DIR }} | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@22fdc77bf4148f810455b226c90fb81b5cbc00a7 # v1.171.1 | |
with: | |
ruby-version: '3.2.2' | |
bundler-cache: true # runs 'bundle install' and caches installed gems automatically | |
working-directory: ${{ env.WEBSITE_SOURCES_DIR }} | |
- name: Prune current content | |
working-directory: ${{ env.WEBSITE_CONTENT_DIR }} | |
run: git rm -rf * | |
- name: Build website | |
working-directory: ${{ env.WEBSITE_SOURCES_DIR }} | |
env: | |
JEKYLL_ENV: production | |
run: | | |
bundle exec jekyll build | |
mv _site/sirius/* ${{ github.workspace }}/${{ env.WEBSITE_CONTENT_DIR }} | |
- name: Check for content changes | |
id: git-check | |
working-directory: ${{ env.WEBSITE_CONTENT_DIR }} | |
run: | | |
git add -A | |
echo ::set-output name=modified::$(if git diff --cached --exit-code --quiet; then echo "false"; else echo "true"; fi) | |
- name: Push content changes | |
if: steps.git-check.outputs.modified == 'true' | |
working-directory: ${{ env.WEBSITE_CONTENT_DIR }} | |
run: | | |
git config user.name ${{ github.event.head_commit.author.name }} | |
git config user.email ${{ github.event.head_commit.author.email }} | |
git config -l | grep 'http\..*\.extraheader' | cut -d= -f1 | xargs -L1 git config --unset-all | |
git remote set-url origin https://x-access-token:${{ secrets.GH_ACTION_TOKEN }}@github.com/${{ env.WEBSITE_CONTENT_REPO }} | |
git commit -am "${{ github.event.head_commit.message }}" | |
git push origin |