CodeTotal v0.3.0 #3
Workflow file for this run
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 & Push - RELEASE" | |
on: | |
release: | |
# Want to run the automation when a release is created | |
types: ["created"] | |
############### | |
# Set the Job # | |
############### | |
jobs: | |
build: | |
# Name the Job | |
name: Build & Deploy Docker Image - RELEASE | |
# Set the agent to run on | |
runs-on: ubuntu-latest | |
# Only run on main repo | |
if: github.repository == 'oxsecurity/codetotal' && !contains(github.event.head_commit.message, 'skip deploy') | |
permissions: | |
packages: write | |
environment: | |
name: release | |
################## | |
# Load all steps # | |
################## | |
steps: | |
########################## | |
# Checkout the code base # | |
########################## | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
# - name: Login to Docker Hub | |
# uses: docker/login-action@v2 | |
# with: | |
# username: ${{ secrets.DOCKER_USERNAME }} | |
# password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get current date | |
run: echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> ${GITHUB_ENV} | |
- name: Build Image | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: Dockerfile-release | |
platforms: linux/amd64 | |
build-args: | | |
CODETOTAL_BASE_IMAGE=ghcr.io/oxsecurity/codetotal-server:beta | |
BUILD_DATE=${{ env.BUILD_DATE }} | |
BUILD_REVISION=${{ github.sha }} | |
BUILD_VERSION=${{ github.event.release.tag_name }} | |
load: false | |
push: true | |
secrets: | | |
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} | |
tags: | | |
ghcr.io/oxsecurity/codetotal-server:latest | |
ghcr.io/oxsecurity/codetotal-server:${{ github.event.release.tag_name }} |