Skip to content

Commit

Permalink
fix(ci): 🐛 (#387) issues within ci
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasAugustin committed Sep 24, 2023
1 parent 3130f5b commit c22168b
Show file tree
Hide file tree
Showing 6 changed files with 104 additions and 15 deletions.
35 changes: 21 additions & 14 deletions .github/workflows/push_docker.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
name: push-docker

on:
workflow_dispatch:
workflow_call:
inputs:
tag:
description: "The docker image tag"
required: true
type: string
secrets:
DOCKERHUB_USERNAME:
description: "The dockerhub username"
required: true
DOCKERHUB_TOKEN:
description: "The dockerhub token"
required: true
workflow_dispatch:
inputs:
tag:
description: "The docker image tag"
required: true
type: string

jobs:
build_and_push:
Expand Down Expand Up @@ -43,23 +60,13 @@ jobs:
with:
context: ./src/
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
tags: ${{ inputs.tag }} #${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Docker Hub Description
uses: peter-evans/dockerhub-description@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: andyAugustin/${{ matrix.variant }}
# readme-filepath: ./images/${{ matrix.variant }}/README.md
# short-description: See https://github.com/${{ github.repository }}/images/${{ matrix.variant }} for the source.
- name: run tests
run: |
echo "Install container tools"
curl -LO https://storage.googleapis.com/container-structure-test/latest/container-structure-test-linux-amd64 \
&& chmod +x container-structure-test-linux-amd64 \
&& sudo mv container-structure-test-linux-amd64 /usr/local/bin/container-structure-test
echo "Run tests"
container-structure-test test \
--image ghcr.io/andreasaugustin/${{ matrix.variant }}:${{ steps.meta.outputs.version }} \
--config src/test-config.yaml
readme-filepath: ./docs/DOCKER.md
short-description: See https://github.com/${{ github.repository }} to have a look into the source code.
11 changes: 11 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,14 @@ jobs:
packages: write
uses: ./.github/workflows/push_docker.yml
secrets: inherit
call_release_test_docker_images:
if: ${{ needs.release_please.outputs.release_created }}
needs:
- call_push_docker
- call_release_please
permissions:
packages: read
uses: ./.github/workflows/release_test_docker_images.yml
with:
tag: ${{ needs.release_please.outputs.tag_name }}
secrets: inherit
4 changes: 4 additions & 0 deletions .github/workflows/release_please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ permissions:
jobs:
release_please:
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release_please.outputs.release_created }}
tag_name: ${{ steps.release_please.outputs.tag_name }}
steps:
- uses: google-github-actions/release-please-action@v3
id: release_please
with:
release-type: simple
package-name: actions-template-sync
63 changes: 63 additions & 0 deletions .github/workflows/release_test_docker_images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: release-test-docker-images

on:
workflow_call:
inputs:
tag:
description: "The docker image tag"
required: true
type: string
secrets:
DOCKERHUB_USERNAME:
description: "The dockerhub username"
required: true
DOCKERHUB_TOKEN:
description: "The dockerhub token"
required: true
workflow_dispatch:
inputs:
tag:
description: "The docker image tag"
required: true
type: string

permissions:
packages: read

jobs:
test-docker-images:
strategy:
matrix:
docker-image:
- ghcr.io/andreasaugustin/actions-template-sync
- andyaugustin/actions-template-sync
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
lfs: true
fetch-depth: 0
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: pull image
run: |
docker pull ${{ matrix.docker-image }}:${{ inputs.tag }}
- name: run tests
run: |
echo "Install container tools"
curl -LO https://storage.googleapis.com/container-structure-test/latest/container-structure-test-linux-amd64 \
&& chmod +x container-structure-test-linux-amd64 \
&& sudo mv container-structure-test-linux-amd64 /usr/local/bin/container-structure-test
echo "Run tests"
container-structure-test test \
--image ${{ matrix.docker-image }}:${{ inputs.tag }} \
--config src/test-config.yaml
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,8 @@ It can also be stored inside `.github` folder.

_Note: It is not possible to sync also the `.templatesyncignore` itself. Any changes from the template repository will be restored automatically._

**Remark** reading the [gitglossary][git-glossary] (_pathspec_ section) you see a slight difference to the `.gitignore` file when you like to disable files.
**Remark** reading the [gitglossary][git-glossary] (_pathspec_ section) you see a slight difference to the `.gitignore` file
when you like to disable files you need to use `:!`.
E.g. when you like to disable the sync for all files with exceptions, you need to do smth like

```txt
Expand Down
3 changes: 3 additions & 0 deletions docs/DOCKER.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# DOCKER

## abstract

0 comments on commit c22168b

Please sign in to comment.