Skip to content

Commit

Permalink
github action - new yml file
Browse files Browse the repository at this point in the history
  • Loading branch information
SydZero committed Sep 16, 2024
1 parent 499829d commit 5b596ae
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 4 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/docker_image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Build and Deploy Docker Image

on:
push:
branches:
- main
- Add_Docker_Image_Action
tags:
- 'v*.*.*'
workflow_dispatch:

jobs:
build-and-push:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build Docker image
uses: docker/build-push-action@v4
with:
context: .
file: .devcontainer/Dockerfile.codespace
push: false
tags: ghcr.io/ncar/music-box:build-temp

- name: Build and push Docker image (latest)
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v4
with:
context: .
file: .devcontainer/Dockerfile.codespace
push: true
tags: ghcr.io/ncar/music-box:latest

- name: Build and push Docker image (tagged)
if: startsWith(github.ref, 'refs/tags/')
uses: docker/build-push-action@v4
with:
context: .
file: .devcontainer/Dockerfile.codespace
push: true
tags: ghcr.io/ncar/music-box:${{ github.ref_name }}
5 changes: 1 addition & 4 deletions .github/workflows/npm_build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,4 @@ jobs:
- run: npm run build --if-present
- run: npm test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
- name: Build and push Docker images
uses: docker/[email protected]

uses: codecov/codecov-action@v1

0 comments on commit 5b596ae

Please sign in to comment.