-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
56 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,64 @@ | ||
# name: Build and Publish | ||
|
||
# on: | ||
# # run it on push to the default repository branch | ||
# #push: | ||
# # branches: [master] | ||
|
||
# # run it during pull request | ||
# release: | ||
# pull_request: | ||
# branches: | ||
# - master | ||
# jobs: | ||
# run_if: | ||
# if: startsWith(github.head_ref, 'releases/') | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - run: echo "The head of this PR starts with 'releases/'" | ||
|
||
# - name: Checkout code | ||
# uses: actions/checkout@v1 | ||
|
||
|
||
# - name: Set up Docker Buildx | ||
# uses: docker/setup-buildx-action@v1 | ||
# - name: build docker images | ||
# run: docker build . -t goglang:1.10.0 -f ./guestbook-go/Dockerfile | ||
# - name: tag docker image | ||
# run: docker tag goglang:1.10.0 dikshasahu/golang-image-new:latest | ||
# - name: Login to DockerHub | ||
# uses: docker/login-action@v1 | ||
# with: | ||
# username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
# password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
# - name: Push docker image | ||
# run: docker push dikshasahu/golang-image-new:latest | ||
|
||
|
||
name: Build and Publish | ||
|
||
on: | ||
# run it on push to the default repository branch | ||
#push: | ||
# branches: [master] | ||
|
||
# run it during pull request | ||
release: | ||
push: | ||
branches: [ "master" ] | ||
pull_request: | ||
branches: | ||
- master | ||
branches: [ "master" ] | ||
|
||
jobs: | ||
run_if: | ||
if: startsWith(github.head_ref, 'releases/') | ||
build_dev_image: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: echo "The head of this PR starts with 'releases/'" | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v1 | ||
|
||
- uses: actions/checkout@v2 | ||
|
||
- name: Docker login | ||
env: | ||
DOCKER_USER: ${{ secrets.DOCKER_USER }} | ||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | ||
run: | | ||
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD | ||
- name: Build the Docker image | ||
run: docker build . -t goglang:1.10.0 -f ./guestbook-go/Dockerfile | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- name: build docker images | ||
run: docker build . -t goglang:1.10.0 -f ./guestbook-go/Dockerfile | ||
- name: tag docker image | ||
run: docker tag goglang:1.10.0 dikshasahu/golang-image-new:latest | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: Push docker image | ||
run: docker push dikshasahu/golang-image-new:latest | ||
- name: Docker Push | ||
run: docker push dikshasahu/golang-image-new:dev |