update carousels, downsize further #317
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: abtech.org | |
on: | |
push: | |
branches: | |
- 'main' | |
- 'dev' | |
- '!gh-pages' | |
- '!gh-pages-dev' | |
tags: | |
- '*' | |
pull_request: | |
branches: | |
- 'main' | |
- 'dev' | |
jobs: | |
# build-docker: | |
# runs-on: ubuntu-latest | |
# outputs: | |
# IMAGE_ID: ${{ steps.push-image.outputs.IMAGE_ID }} | |
# VERSION: ${{ steps.push-image.outputs.VERSION }} | |
# VERSIONSHA: ${{ steps.push-image.outputs.VERSIONSHA }} | |
# CIVERSION: ${{ steps.push-image.outputs.CIVERSION }} | |
# steps: | |
# - name: Checkout | |
# uses: actions/checkout@v2 | |
# - name: 🏗 Set up build cache | |
# id: cache | |
# uses: actions/cache@v2 | |
# with: | |
# path: /tmp/.docker-cache | |
# key: ${{ runner.os }}-buildDocker-${{ env.cache-name }}-${{ github.ref }}-${{ github.sha }}-${{ hashFiles('**/Dockerfile') }} | |
# restore-keys: | | |
# ${{ runner.os }}-buildDocker-${{ env.cache-name }}-${{ github.ref }}- | |
# ${{ runner.os }}-buildDocker-${{ env.cache-name }}- | |
# - name: Build image | |
# run: docker build . --file Dockerfile --tag ${{ github.event.repository.name }} --label "runnumber=${{ github.run_id }}" | |
# - name: Log into registry | |
# run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
# - name: Push image | |
# id: push-image | |
# if: github.event_name != 'pull_request' | |
# run: | | |
# IMAGE_ID=ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }} | |
# # Change all uppercase to lowercase | |
# IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | |
# # Strip git ref prefix from version | |
# VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
# # Strip "v" prefix from tag name | |
# [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') | |
# # Use sha too | |
# VERSIONSHA="${{ github.sha }}" | |
# echo IMAGE_ID=$IMAGE_ID | |
# echo VERSION=$VERSION | |
# echo VERSIONSHA=$VERSIONSHA | |
# [[ "${{ github.event_name }}" != "pull_request" ]] && CIVERSION=$VERSIONSHA | |
# [[ "${{ github.event_name }}" == "pull_request" ]] && CIVERSION="latest" | |
# echo "::set-output name=IMAGE_ID::$IMAGE_ID" | |
# echo "::set-output name=VERSION::$VERSION" | |
# echo "::set-output name=VERSIONSHA::$VERSIONSHA" | |
# echo "::set-output name=CIVERSION::$CIVERSION" | |
# # Use Docker `latest` tag convention | |
# if [[ "${{ github.event_name }}" != "pull_request" ]]; then | |
# [ "$VERSION" == "main" ] && docker tag ${{ github.event.repository.name }} $IMAGE_ID:latest | |
# docker tag ${{ github.event.repository.name }} $IMAGE_ID:$VERSION | |
# docker tag ${{ github.event.repository.name }} $IMAGE_ID:$VERSIONSHA | |
# docker push $IMAGE_ID --all-tags | |
# fi | |
build: | |
# needs: build-docker | |
runs-on: ubuntu-latest | |
container: | |
# image: ${{ needs.build-docker.outputs.IMAGE_ID }}:${{ needs.build-docker.outputs.CIVERSION }} | |
image: "ghcr.io/abtech/abtech.org:fefc2b479d4c22d6b3e00b1b359a5be2780d7fbe" | |
steps: | |
- name: Checkout latest | |
uses: actions/checkout@v2 | |
# - name: Cache Ruby dependencies | |
# uses: actions/cache@v2 | |
# env: | |
# cache-name: cache-ruby-gems | |
# with: | |
# path: vendor/bundle | |
# key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.ref }}-${{ hashFiles('**/Gemfile.lock', '**/Gemfile', '**/Dockerfile') }} | |
# restore-keys: | | |
# ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.ref }}- | |
# ${{ runner.os }}-build-${{ env.cache-name }}- | |
# - name: Cache NodeJS dependencies | |
# uses: actions/cache@v2 | |
# env: | |
# cache-name: cache-node-modules | |
# with: | |
# path: ~/.npm | |
# key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.ref }}-${{ hashFiles('**/package-lock.json', '**/package.json', '**/Dockerfile') }} | |
# restore-keys: | | |
# ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.ref }}- | |
# ${{ runner.os }}-build-${{ env.cache-name }}- | |
- name: Install all dependencies # This includes bundler with NPM preinstall script | |
run: npm install --unsafe-perm | |
- name: Build Jekyll | |
run: npm run-script build-prod | |
- name: Archive files | |
run: tar -cvf _site.tar -C _site . | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: "_site.tar" | |
path: _site.tar | |
publish: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }}-publish | |
needs: build | |
runs-on: ubuntu-latest | |
if: | | |
github.ref == 'refs/heads/main' && | |
github.event_name != 'pull_request' | |
steps: | |
- name: Checkout gh-pages branch of repo | |
uses: actions/checkout@v2 | |
with: | |
ref: "gh-pages" | |
- name: Clear branch of previous build | |
run: | | |
git rm -rf . --ignore-unmatch | |
git clean -fxd | |
- name: Download built artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: "_site.tar" | |
- name: 'Unarchive files & remove archive' | |
run: tar -xvf _site.tar && rm _site.tar | |
- name: Commit and push new artifact | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
git add . --all | |
git commit --allow-empty -m "abtech.org publish $GITHUB_SHA" | |
git push | |
publish-dev: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }}-publish-dev | |
needs: build | |
runs-on: ubuntu-latest | |
if: | | |
github.ref == 'refs/heads/dev' && | |
github.event_name != 'pull_request' | |
steps: | |
- name: Checkout gh-pages-dev branch of repo | |
uses: actions/checkout@v2 | |
with: | |
ref: "gh-pages-dev" | |
- name: Clear branch of previous build | |
run: | | |
git rm -rf . --ignore-unmatch | |
git clean -fxd | |
- name: Download built artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: "_site.tar" | |
- name: 'Unarchive files & remove archive' | |
run: tar -xvf _site.tar && rm _site.tar | |
- name: Commit and push new artifact | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
git add . --all | |
git commit --allow-empty -m "abtech.org publish $GITHUB_SHA" | |
git push |