Update main.yml #13
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
name: build and dockerize the application | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.21 | |
- name: Build | |
run: go build -v . | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
# 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: 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 |