Skip to content

actions-timelineの導入 #515

actions-timelineの導入

actions-timelineの導入 #515

Workflow file for this run

# ref: https://dev.to/cloudx/multi-arch-docker-images-the-easy-way-with-github-actions-4k54
name: Docker
# Controls when the workflow will run
on:
push:
branches:
- 'main'
tags:
- 'v*.*.*'
pull_request:
branches:
- 'main'
env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
permissions:
contents: write
packages: write
runs-on: ubuntu-latest
env:
flags: ""
steps:
- uses: Kesin11/actions-timeline@v1
- if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
run: echo "flags=--snapshot" >> $GITHUB_ENV
# Get the repository's code
- name: Checkout
uses: actions/checkout@v3
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Setup go
uses: actions/setup-go@v4
with:
go-version: "1.20"
cache: true
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "18"
cache: "yarn"
cache-dependency-path: "frontend/yarn.lock"
- name: Install dependencies
run: |
yarn --frozen-lockfile
working-directory: frontend
- name: Build frontend
run: |
yarn build
working-directory: frontend
- name: Run goreleaser build
if: github.event_name == 'pull_request'
uses: goreleaser/goreleaser-action@v4
with:
args: build --snapshot --single-target
- name: Run goreleaser release
if: github.event_name != 'pull_request'
uses: goreleaser/goreleaser-action@v4
with:
args: release ${{ env.flags }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}