Skip to content

Update main.yml

Update main.yml #21

Workflow file for this run

name: build and dockerize the application
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
# Because the .env file is not in the repository, we need to create it
# using the secrets.ENV_FILE secret
- name: Create env file
run: |
touch .env
echo "${{ secrets.ENV_FILE }}" > .env
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21
- name: Build
run: go build -v .
- name: Upload .env file
uses: actions/upload-artifact@v2
with:
name: env-file
path: .env
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download .env file
uses: actions/download-artifact@v2
with:
name: env-file
path: .
- name: Login to Dockerhub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and release to DockerHub
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/goanonpicdb-aws:latest