feat: Update exam constants to FINAL_SUMMER_24 and adjust related logic #10
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 Push to GHCR | |
on: | |
push: | |
branches: | |
- live | |
release: | |
types: [published] | |
env: | |
SHORT_SHA: ${{ github.sha }} | |
IMAGE_NAME: ${{ github.repository_owner }}/uiubot | |
IMAGE_TAG: ${{ github.ref_type == 'tag' && github.ref || contains(github.event.head_commit.message, 'latest') && 'latest' || 'dev' }} | |
jobs: | |
push-ghcr: | |
if: contains(github.event.head_commit.message, 'BUILD') || github.event_name == 'release' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Go 1.22.x | |
uses: actions/setup-go@v4 | |
with: | |
go-version: "1.22.x" | |
- name: Install Go dependencies | |
run: go mod download | |
- name: 🔑 Login to GHCR | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GCR_TOKEN }} | |
- name: 🏗️ Build and push | |
run: | | |
if [[ $IMAGE_TAG == *"refs/tags/"* ]]; then | |
IMAGE_TAG=$(echo $IMAGE_TAG | sed 's/refs\/tags\///') | |
export IMAGE_TAG | |
fi | |
echo "==>> IMAGE_TAG: $IMAGE_TAG" | |
docker build -t ghcr.io/${{ env.IMAGE_NAME }}:$IMAGE_TAG -t ghcr.io/${{ env.IMAGE_NAME }}:${{ env.SHORT_SHA }} . | |
docker push ghcr.io/${{ env.IMAGE_NAME }}:${{ env.SHORT_SHA }} | |
docker push ghcr.io/${{ env.IMAGE_NAME }}:$IMAGE_TAG | |
# push-ecr: | |
# if: contains(github.event.head_commit.message, 'BUILD') || github.event_name == 'release' | |
# runs-on: ubuntu-latest | |
# env: | |
# IMAGE_TAG: ${{ github.ref_type == 'tag' && github.ref || contains(github.event.head_commit.message, 'latest') && 'latest' || 'dev' }} | |
# steps: | |
# - name: Checkout code | |
# uses: actions/checkout@v4 | |
# - name: Setup Go 1.22.x | |
# uses: actions/setup-go@v4 | |
# with: | |
# go-version: "1.22.x" | |
# - name: Install Go dependencies | |
# run: go mod download | |
# - name: Configure AWS credentials | |
# uses: aws-actions/configure-aws-credentials@v1 | |
# with: | |
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
# aws-region: us-east-1 | |
# - name: Login to Amazon ECR | |
# id: login-ecr | |
# uses: aws-actions/amazon-ecr-login@v2 | |
# - name: Build, Tag, and Push the Image to Amazon ECR | |
# id: build-image | |
# env: | |
# ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | |
# ECR_REPOSITORY: ${{ secrets.ECR_REPOSITORY }} | |
# IMAGE_TAG: ${{ env.IMAGE_TAG }} | |
# run: | | |
# if [[ $IMAGE_TAG == *"refs/tags/"* ]]; then | |
# IMAGE_TAG=$(echo $IMAGE_TAG | sed 's/refs\/tags\///') | |
# export IMAGE_TAG | |
# fi | |
# echo "==>> IMAGE_TAG: $IMAGE_TAG" | |
# docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . | |
# docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG |