Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

image buildのworkflowを1ファイルにまとめる #713

Merged
merged 3 commits into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 24 additions & 8 deletions .github/workflows/staging.yaml → .github/workflows/image.yaml
Original file line number Diff line number Diff line change
@@ -1,39 +1,55 @@
name: Build image (main)
name: Build image

on:
workflow_dispatch:
push:
branches:
- main
tags:
- v*
pull_request:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

総実行時間は増えるかもしれないが一旦PR時もビルドしてみることにした
image pushはしない

branches:
- main

env:
IMAGE_NAME: traportfolio
IMAGE_TAG: main

jobs:
image:
build:
name: Build Docker Image
permissions:
contents: read
packages: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Generate Image Tags
uses: docker/metadata-action@v5
id: meta
with:
images: ghcr.io/traptitech/${{ env.IMAGE_NAME }}
- name: Login to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: traptitech
password: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v4
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: true
push: ${{ github.event_name != 'pull_request' }}
platforms: linux/amd64
tags: ghcr.io/traptitech/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

deploy-staging:
name: Deploy staging
name: Deploy to staging
if: github.event_name == 'push' && github.ref_name == 'main'
runs-on: ubuntu-latest
needs: [image]
needs:
- build
steps:
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
Expand Down
35 changes: 0 additions & 35 deletions .github/workflows/release.yaml

This file was deleted.