Merge pull request #169 from kmc-jp/container #202
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: Test & Build | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: .ruby-version | |
bundler-cache: true | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
cache: npm | |
- name: Install npm modules | |
run: | | |
npm ci | |
- name: Copy config | |
run: | | |
sed 's/development:/production:/' config/guildbook.yml.example > config/guildbook.yml | |
- name: Build assets | |
run: | | |
npm run build | |
- name: Test | |
run: | | |
bundle exec rspec | |
build: | |
needs: | |
- test | |
runs-on: ubuntu-latest | |
steps: | |
- id: meta | |
name: Docker meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
ghcr.io/${{ github.repository_owner }}/guildbook | |
tags: | | |
type=raw,value={{sha}}-{{date 'YYYYMMDDHHmmss'}} | |
- uses: docker/setup-buildx-action@v3 | |
- uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ github.token }} | |
- uses: docker/build-push-action@v5 | |
with: | |
push: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }} | |
tags: ${{ steps.meta.output.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |