Skip to content

Commit

Permalink
add build
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticroentgen committed Jul 27, 2024
1 parent d0ead73 commit dbe5c62
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 0 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Build and Deploy Vue.js App

on:
push:
branches:
- main # Set to the branch name you use for releases
tags: ['v*.*.*']
pull_request:
branches:
- main

jobs:
build_vue:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22' # Set this to the node version you use

- name: Install dependencies
run: npm install

- name: Build Vue.js project
run: npm run build

- name: Upload dist directory to workspace
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/

build_and_push_docker:
needs: build_vue
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Download dist directory
uses: actions/download-artifact@v4
with:
name: dist
path: dist

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

- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
tags: ghcr.io/${{ github.repository }}/vue-app:${{ github.sha }}


3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM nginx
COPY dist/ /usr/share/nginx/html/

0 comments on commit dbe5c62

Please sign in to comment.