Skip to content

Commit

Permalink
fix(ci): 🐛 (#387) issue with docker push (#392)
Browse files Browse the repository at this point in the history
* fix(ci): 🐛  (#387) issues within ci

* fix(ci): 🐛  (#387) issues within ci

* fix(ci): 🐛  (#387) issues within ci

* fix(ci): 🐛  (#387) issues within ci

* fix(ci): 🐛  (#387) issues within ci
  • Loading branch information
AndreasAugustin authored Sep 24, 2023
1 parent 0818ac0 commit a94785c
Show file tree
Hide file tree
Showing 7 changed files with 121 additions and 14 deletions.
34 changes: 21 additions & 13 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 @@ -38,6 +55,7 @@ jobs:
images: |
andyAugustin/${{ matrix.variant }}
ghcr.io/AndreasAugustin/${{ matrix.variant }}
tags: ${{ inputs.tag }},latest
- name: Build and push ${{ matrix.variant }}
uses: docker/build-push-action@v3
with:
Expand All @@ -51,15 +69,5 @@ jobs:
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
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,10 @@ jobs:
| git_user_email | `[optional]` set the committer git user.email | `false` | `github-action@actions-template-sync.noreply.${SOURCE_REPO_HOSTNAME}` |
| git_remote_pull_params |`[optional]` set remote pull parameters | `false` | `--allow-unrelated-histories --squash --strategy=recursive -X theirs` |

### Docker

There are docker images available. Please checkout [How to use docker](docs/DOCKER.md) for details.

### Example

This repo uses this [template][template] and this action from the [marketplace][marketplace].
Expand All @@ -251,7 +255,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
15 changes: 15 additions & 0 deletions docs/DOCKER.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# DOCKER

## abstract

If you want to test things out or if you want to build your own action (e.g. in on prem environments) you are able to use docker images.

- [github registry][github-repo]
- [dockerhub registry][dockerhub-repo]

## Use the image

TODO

[dockerhub-repo]: https://hub.docker.com/r/andyaugustin/actions-template-sync
[github-repo]: https://github.com/AndreasAugustin/actions-template-sync/pkgs/container/actions-template-sync
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ flowchart LR
```

- [architecture](./ARCHITECTURE.md)
- [how to use the docker images](./DOCKER.md)

0 comments on commit a94785c

Please sign in to comment.