37 lines
969 B
YAML
37 lines
969 B
YAML
name: Build and Push Docker Image
|
|
# This workflow is manually triggered from the "Actions" tab in GitHub.
|
|
# It requires a single input: the version tag of the flood repository to use.
|
|
on:
|
|
push:
|
|
branches: [ "main" ]
|
|
pull_request:
|
|
branches: [ "main" ]
|
|
schedule:
|
|
- cron: '0 0 3 * *' # This runs at midnight on the first day of every month
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Set Image name
|
|
run: |
|
|
echo "IMAGE_NAME=k2patel/apcupsd-client:latest" >> $GITHUB_ENV
|
|
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Log in to Docker Hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_TOKEN }}
|
|
|
|
- name: Build the Docker image
|
|
id: build
|
|
run: |
|
|
docker build . -t ${{ env.IMAGE_NAME }}
|
|
|
|
- name: Push the Docker image
|
|
run: docker push ${{ env.IMAGE_NAME }} |