Skip to content

Commit

Permalink
feat: Create main.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
giosueDelgado authored Dec 8, 2023
1 parent 03670fb commit 751f74c
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Docker Image CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:

build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to the Container registry
env:
REGISTRY: ghcr.io
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Define date and short SHA
id: vars
run: |
echo "date=$(date +'%Y%m%d.%H%M%S')" >> $GITHUB_OUTPUT
echo "short_sha=$(echo ${{ github.sha }} | cut -c 1-7)" >> $GITHUB_OUTPUT
- name: Build and push Docker image
uses: docker/build-push-action@v4ì
with:
push: true
tags: |
ghcr.io/relybytes/nginx-certbot:latest
ghcr.io/relybytes/nginx-certbot:${{ steps.vars.outputs.date }}-${{ steps.vars.outputs.short_sha }}

0 comments on commit 751f74c

Please sign in to comment.