Nightly Build Ubuntu 22.04 Image #18
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: Nightly Build Ubuntu 22.04 Image | |
on: | |
schedule: | |
- cron: '0 2 * * *' # Runs at 2 AM UTC every day | |
workflow_dispatch: # Allows manual triggering | |
permissions: | |
contents: read | |
packages: write | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest-8-cores | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Packer | |
uses: hashicorp/setup-packer@v3 | |
- name: Initialize Packer | |
run: packer init images/ubuntu/templates/ubuntu-22.04.pkr.hcl | |
- name: Build Packer Image | |
run: packer build images/ubuntu/templates/ubuntu-22.04.pkr.hcl | |
- name: configure aws credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: arn:aws:iam::894269471382:role/GithubActionRole | |
role-session-name: githubactionsession | |
aws-region: eu-central-1 | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v2 | |
- name: Push Docker image | |
run: | | |
docker tag ghcr.io/${{ github.repository }}:ubuntu-22.04-latest ${{ steps.login-ecr.outputs.registry }}/actions-runner:ubuntu-22.04-latest | |
docker push ${{ steps.login-ecr.outputs.registry }}/actions-runner:ubuntu-22.04-latest | |
# docker tag ghcr.io/${{ github.repository }}:ubuntu-22.04-nightly-$(date +'%Y%m%d') ${{ steps.login-ecr.outputs.registry }}/actions-runner:ubuntu-22.04-nightly-$(date +'%Y%m%d') | |
# docker push ${{ steps.login-ecr.outputs.registry }}/actions-runner:ubuntu-22.04-nightly-$(date +'%Y%m%d') |