bring over ci setup
This commit is contained in:
@@ -0,0 +1,84 @@
|
|||||||
|
name: Docker
|
||||||
|
|
||||||
|
# This workflow uses actions that are not certified by GitHub.
|
||||||
|
# They are provided by a third-party and are governed by
|
||||||
|
# separate terms of service, privacy policy, and support
|
||||||
|
# documentation.
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'main'
|
||||||
|
paths-ignore:
|
||||||
|
- 'README.md'
|
||||||
|
# Publish semver tags as releases. Allow for '-alpha'
|
||||||
|
# stage releases as well.
|
||||||
|
tags:
|
||||||
|
- 'v*.*.*'
|
||||||
|
- 'v*.*.*-alpha'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- 'main'
|
||||||
|
paths-ignore:
|
||||||
|
- 'README.md'
|
||||||
|
|
||||||
|
env:
|
||||||
|
# Use docker.io for Docker Hub if empty
|
||||||
|
REGISTRY: ghcr.io
|
||||||
|
# github.repository as <account>/<repo>
|
||||||
|
IMAGE_NAME: ${{ github.repository }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
# Login against a Docker registry except on PR
|
||||||
|
# https://github.com/docker/login-action
|
||||||
|
- name: Log into registry ${{ env.REGISTRY }}
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
registry: ${{ env.REGISTRY }}
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
# Extract metadata (tags, labels) for Docker
|
||||||
|
# https://github.com/docker/metadata-action
|
||||||
|
- name: Extract Docker metadata
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v3
|
||||||
|
with:
|
||||||
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||||
|
|
||||||
|
# Build and push Docker image with Buildx (don't push on PR)
|
||||||
|
# https://github.com/docker/build-push-action
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: Dockerfile
|
||||||
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
|
||||||
|
- name: Render Action Metadata
|
||||||
|
if: ${{ github.event_name != 'pull_request' }}
|
||||||
|
run: |
|
||||||
|
./bin/render_action_metadata "docker://ghcr.io/actions/jekyll-build-pages:${{ github.ref_name }}" > action.yml
|
||||||
|
git add action.yml
|
||||||
|
git config --local user.name "github-actions[bot]"
|
||||||
|
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
|
git commit -m "Add generated action.yml 🤖"
|
||||||
|
if [[ '${{ github.ref_type }}' == 'tag' ]]; then
|
||||||
|
echo "Pushing tag ${{ github.ref_name }}"
|
||||||
|
git tag -f ${{ github.ref_name }}
|
||||||
|
git push -f origin ${{ github.ref_name }}
|
||||||
|
else
|
||||||
|
echo "Pushing branch ${{ github.ref_name }}"
|
||||||
|
git push origin ${{ github.ref_name }}
|
||||||
|
fi
|
||||||
|
|
||||||
@@ -0,0 +1,138 @@
|
|||||||
|
name: 'Test'
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths-ignore:
|
||||||
|
- 'README.md'
|
||||||
|
pull_request:
|
||||||
|
paths-ignore:
|
||||||
|
- 'README.md'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test-simple:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
TEST_NAME: simple
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Render Action Metadata
|
||||||
|
run: |
|
||||||
|
./bin/render_action_metadata Dockerfile > action.yml
|
||||||
|
|
||||||
|
- name: Test ${{ env.TEST_NAME }} Project
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
source: ./test_projects/${{ env.TEST_NAME }}
|
||||||
|
destination: ./test_projects/${{ env.TEST_NAME }}/_site
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Save test results
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: ${{ env.TEST_NAME }}
|
||||||
|
path: ./test_projects/${{ env.TEST_NAME }}
|
||||||
|
|
||||||
|
test-readme:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
TEST_NAME: readme
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Render Action Metadata
|
||||||
|
run: |
|
||||||
|
./bin/render_action_metadata Dockerfile > action.yml
|
||||||
|
|
||||||
|
- name: Test ${{ env.TEST_NAME }} Project
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
source: ./test_projects/${{ env.TEST_NAME }}
|
||||||
|
destination: ./test_projects/${{ env.TEST_NAME }}/_site
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Save test results
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: ${{ env.TEST_NAME }}
|
||||||
|
path: ./test_projects/${{ env.TEST_NAME }}
|
||||||
|
|
||||||
|
test-mojombo:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
TEST_NAME: mojombo
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Render Action Metadata
|
||||||
|
run: |
|
||||||
|
./bin/render_action_metadata Dockerfile > action.yml
|
||||||
|
|
||||||
|
- name: Test ${{ env.TEST_NAME }} Project
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
source: ./test_projects/${{ env.TEST_NAME }}
|
||||||
|
destination: ./test_projects/${{ env.TEST_NAME }}/_site
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Save test results
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: ${{ env.TEST_NAME }}
|
||||||
|
path: ./test_projects/${{ env.TEST_NAME }}
|
||||||
|
|
||||||
|
test-themes:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
TEST_NAME: themes
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Render Action Metadata
|
||||||
|
run: |
|
||||||
|
./bin/render_action_metadata Dockerfile > action.yml
|
||||||
|
|
||||||
|
- name: Test ${{ env.TEST_NAME }} Project
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
source: ./test_projects/${{ env.TEST_NAME }}
|
||||||
|
destination: ./test_projects/${{ env.TEST_NAME }}/_site
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Save test results
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: ${{ env.TEST_NAME }}
|
||||||
|
path: ./test_projects/${{ env.TEST_NAME }}
|
||||||
|
|
||||||
|
test-jekyll-include-cache:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
TEST_NAME: jekyll-include-cache
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Render Action Metadata
|
||||||
|
run: |
|
||||||
|
./bin/render_action_metadata Dockerfile > action.yml
|
||||||
|
|
||||||
|
- name: Test ${{ env.TEST_NAME }} Project
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
source: ./test_projects/${{ env.TEST_NAME }}
|
||||||
|
destination: ./test_projects/${{ env.TEST_NAME }}/_site
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Save test results
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: ${{ env.TEST_NAME }}
|
||||||
|
path: ./test_projects/${{ env.TEST_NAME }}
|
||||||
|
|
||||||
Reference in New Issue
Block a user