You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
101 lines
3.9 KiB
101 lines
3.9 KiB
name: workflow-docker-manual
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
tags:
|
|
description: 'Enter tag name for test/dev image'
|
|
default: 'test'
|
|
|
|
jobs:
|
|
gcr-dockerhub-build-publish:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v1
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
- name: Login to GitHub
|
|
uses: docker/login-action@v1
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.CR_PAT }}
|
|
- name: Login to GitLab
|
|
uses: docker/login-action@v1
|
|
with:
|
|
registry: registry.gitlab.com
|
|
username: ${{ secrets.GITLAB_USERNAME }}
|
|
password: ${{ secrets.GITLAB_TOKEN }}
|
|
- name: Show Runners environment (debug)
|
|
uses: nick-invision/retry@v2.4.0
|
|
with:
|
|
timeout_minutes: 5
|
|
max_attempts: 3
|
|
retry_wait_seconds: 120
|
|
command: |
|
|
export
|
|
- name: Generate temporary tag name
|
|
shell: bash
|
|
run: |
|
|
test_tag=$(date +%Y%m%d%H%M%S)
|
|
echo "[debug] Generated test tag name is '${test_tag}'"
|
|
echo "::set-output name=test_tag::$test_tag"
|
|
id: generate_temporary_tag_name
|
|
- name: Generate app name
|
|
shell: bash
|
|
run: |
|
|
app_name=$(echo "${GITHUB_REPOSITORY}" | grep -P -o -m 1 '(?<=/arch-).*')
|
|
echo "[debug] Generated app name is '${app_name}'"
|
|
echo "::set-output name=app_name::$app_name"
|
|
id: generate_app_name
|
|
- name: Build Docker image and tag
|
|
uses: nick-invision/retry@v2.4.0
|
|
with:
|
|
timeout_minutes: 60
|
|
max_attempts: 3
|
|
retry_wait_seconds: 120
|
|
command: |
|
|
docker build \
|
|
--tag ${{ github.repository }}:${{ steps.generate_temporary_tag_name.outputs.test_tag }} \
|
|
--tag ${{ github.repository }}:${{ github.event.inputs.tags }} \
|
|
--tag ghcr.io/${{ github.repository }}:${{ steps.generate_temporary_tag_name.outputs.test_tag }} \
|
|
--tag ghcr.io/${{ github.repository }}:${{ github.event.inputs.tags }} \
|
|
--tag registry.gitlab.com/${{ github.repository }}:${{ steps.generate_temporary_tag_name.outputs.test_tag }} \
|
|
--tag registry.gitlab.com/${{ github.repository }}:${{ github.event.inputs.tags }} \
|
|
.
|
|
- name: Run Tests
|
|
shell: bash
|
|
run: |
|
|
git_clone_scripts_dest="/tmp/scripts"
|
|
git_clone_scripts_repo="https://github.com/binhex/scripts.git"
|
|
|
|
git clone "${git_clone_scripts_repo}" "${git_clone_scripts_dest}"
|
|
"${git_clone_scripts_dest}/shell/arch/docker/testrunner.sh" --app-name ${{ steps.generate_app_name.outputs.app_name }} --image-name "ghcr.io/${{ github.repository }}:${{ steps.generate_temporary_tag_name.outputs.test_tag }}"
|
|
- name: Push Docker image to Docker Hub
|
|
uses: nick-invision/retry@v2.4.0
|
|
with:
|
|
timeout_minutes: 30
|
|
max_attempts: 3
|
|
retry_wait_seconds: 120
|
|
command: |
|
|
docker push ${{ github.repository }}:${{ github.event.inputs.tags }}
|
|
- name: Push Docker image to GitHub Container Registry (GHCR)
|
|
uses: nick-invision/retry@v2.4.0
|
|
with:
|
|
timeout_minutes: 30
|
|
max_attempts: 3
|
|
retry_wait_seconds: 120
|
|
command: |
|
|
docker push ghcr.io/${{ github.repository }}:${{ github.event.inputs.tags }}
|
|
- name: Push Docker image to GitLab Container Registry (GCR)
|
|
uses: nick-invision/retry@v2.4.0
|
|
with:
|
|
timeout_minutes: 30
|
|
max_attempts: 3
|
|
retry_wait_seconds: 120
|
|
command: |
|
|
docker push registry.gitlab.com/${{ github.repository }}:${{ github.event.inputs.tags }} |