add iputils #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 Docker Image | |
on: | |
workflow_dispatch: | |
inputs: | |
ref: | |
description: 'GitHub REF (branch or SHA) to be used for checkout' | |
required: true | |
app: | |
description: 'Application folder name(s) under /go used to build images. All apps will get built if not specified' | |
required: false | |
push: | |
description: 'Whether to push the results to the container registry and flux artifact registry' | |
required: true | |
default: 'false' | |
push: | |
branches: | |
- main | |
- dev | |
jobs: | |
test-lint-and-push: | |
name: Test, build, and push | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 | |
ref: ${{ inputs.ref }} | |
- name: Extract folder name | |
id: extract_folder_name | |
run: | | |
echo "folder_name=$(basename .)" >> "$GITHUB_OUTPUT" | |
- name: Sanitize branch name | |
id: sanitize_branch_name | |
run: | | |
# Replace characters not allowed in Docker tags with underscores | |
sanitized_name=$(echo "${{ github.ref_name }}" | sed 's/[^A-Za-z0-9_.-]/_/g') | |
echo "branch_name=$sanitized_name" >> "$GITHUB_OUTPUT" | |
- name: Generate image tag | |
id: generate_image_tag | |
run: | | |
echo "image_tag=$(echo ${{ github.sha }} | cut -c 1-8)-$(date +%Y%m%d%H%M%S)" >> "$GITHUB_OUTPUT" | |
- uses: ./.github/actions/build-and-push-image | |
with: | |
root-dir: "." | |
push: ${{ github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.push == 'true') }} | |
image-name: ubuntu | |
image-tag: ${{ steps.sanitize_branch_name.outputs.branch_name }}-${{ steps.generate_image_tag.outputs.image_tag }} | |
dockerhub-username: ${{ secrets.DOCKERHUB_USERNAME }} | |
dockerhub-password: ${{ secrets.DOCKERHUB_TOKEN }} |