Skip to content

CDK for Go requires bash #136

CDK for Go requires bash

CDK for Go requires bash #136

Workflow file for this run

---
name: CI
on:
push:
branches:
- master # Push events on master branch
pull_request: # Run tests for any PRs
env:
IMAGE_NAME: aws-cdk-action
jobs:
# Run tests.
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Docker build
run: docker build . --file Dockerfile --tag image
- name: Docker run
run: docker run --entrypoint cdk image --version
lint:
# Name the Job
name: Lint Code Base
# Set the agent to run on
runs-on: ubuntu-latest
##################
# Load all steps #
##################
steps:
##########################
# Checkout the code base #
##########################
- name: Checkout Code
uses: actions/checkout@v4
################################
# Run Linter against code base #
################################
- name: Lint Code Base
uses: github/super-linter/slim@v5
env:
VALIDATE_ALL_CODEBASE: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Push image to GitHub Packages.
# See also https://docs.docker.com/docker-hub/builds/
push:
# Ensure test job passes before pushing image.
needs: test
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v4
- name: Build image
run: docker build . --file Dockerfile --tag "$IMAGE_NAME"
- name: Log into GitHub Container Registry
run: >
echo "${{ secrets.GITHUB_TOKEN }}" |
docker login https://ghcr.io -u ${{ github.actor }} --password-stdin
- name: Push image to GitHub Container Registry
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/"$IMAGE_NAME"
# Change all uppercase to lowercase
IMAGE_ID=$(echo "$IMAGE_ID" | tr '[:upper:]' '[:lower:]')
SHA="${{ github.sha }}"
# Strip git ref prefix from version
REF=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
echo IMAGE_ID="$IMAGE_ID"
echo SHA="$SHA"
echo REF="$REF"
docker tag "$IMAGE_NAME" "$IMAGE_ID":"$SHA"
docker tag "$IMAGE_NAME" "$IMAGE_ID":"$REF"
docker push "$IMAGE_ID":"$REF"
docker push "$IMAGE_ID":"$SHA"