-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (34 loc) · 1.53 KB
/
build.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
name: Build and Containerize Next.js App
on:
push:
branches:
- main # or the name of your default branch
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Extract Repo Name
id: repo_name
run: echo "::set-output name=REPO_NAME::$(echo $GITHUB_REPOSITORY | cut -d '/' -f2)"
- name: Set git config for safe directory
run: git config --global --add safe.directory /github/workspace
- name: Bump version and push tag
id: bump_version
uses: anothrNick/github-tag-action@1.67.0
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
WITH_V: true
DEFAULT_BUMP: patch # Default bump type (major, minor, patch)
- name: Login to DOCR with Access Token
run: |
echo ${{ secrets.DOCR_TOKEN }} | docker login registry.digitalocean.com -u ${{ secrets.DOCR_TOKEN }} --password-stdin
- name: Debug Print
run: |
echo "REPO_NAME=${{ steps.repo_name.outputs.REPO_NAME }}"
echo "NEW_TAG=${{ steps.bump_version.outputs.newTag }}"
- name: Build Docker Image with New Version
run: docker build -t registry.digitalocean.com/dc-containers-test/${{ steps.repo_name.outputs.REPO_NAME }}:${{ steps.bump_version.outputs.newTag || 'latest' }} .
- name: Push Docker Image to DOCR
run: docker push registry.digitalocean.com/dc-containers-test/${{ steps.repo_name.outputs.REPO_NAME }}:${{ steps.bump_version.outputs.newTag || 'latest' }}