Merge pull request #181 from kmc-jp/dependabot/npm_and_yarn/http-prox… #226
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: time | |
run: | | |
echo "time=$(TZ=UTC date +%Y%m%d%H%M%S)" >> $GITHUB_OUTPUT | |
- id: meta | |
name: Docker meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
ghcr.io/${{ github.repository_owner }}/guildbook | |
tags: | | |
type=raw,value={{sha}}-${{ steps.time.outputs.time }} | |
- id: meta-assets | |
name: Docker meta for assets | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
ghcr.io/${{ github.repository_owner }}/guildbook-assets | |
tags: | | |
type=raw,value={{sha}}-${{ steps.time.outputs.time }} | |
- 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: | |
target: app | |
push: ${{ github.ref == 'refs/heads/master' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- uses: docker/build-push-action@v5 | |
with: | |
target: assets | |
push: ${{ github.ref == 'refs/heads/master' }} | |
tags: ${{ steps.meta-assets.outputs.tags }} | |
labels: ${{ steps.meta-assets.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |