fix: allowed and disallowed file names #281
Workflow file for this run
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: docker | |
on: | |
push: | |
tags: | |
- '*' | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
outputs: | |
wikmd_tags: ${{ steps.meta.outputs.tags }} | |
json: ${{ steps.meta.outputs.json }} | |
strategy: | |
matrix: | |
architecture: | |
- linux/amd64 | |
# - linux/arm64 | |
steps: | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: linbreux/wikmd | |
tags: | | |
type=ref,event=pr | |
type=ref,event=tag | |
type=edge | |
- name: Check docker image tag | |
run: echo "Creating Docker image ${{ steps.meta.outputs.tags }}" | |
- name: Build & export | |
uses: docker/build-push-action@v3 | |
with: | |
file: Dockerfile | |
push: false | |
tags: ${{ steps.meta.outputs.tags }} | |
outputs: type=docker,dest=/tmp/wikmd.tar | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wikmd | |
path: /tmp/wikmd.tar | |
test: | |
runs-on: ubuntu-latest | |
needs: build | |
strategy: | |
fail-fast: false | |
matrix: | |
tag: ${{ fromJSON(needs.build.outputs.json).tags }} | |
name: "test-${{ matrix.tag }}" | |
steps: | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Download artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: wikmd | |
path: /tmp | |
- name: Load image | |
run: | | |
docker load --input /tmp/wikmd.tar | |
docker image ls -a | |
# Start a default wikmd container | |
- name: Start wikmd | |
run: docker run -d --name wikmd -p 5000:5000 ${{ matrix.tag }} | |
# Wait for wikmd to be up and running | |
- name: Sleep | |
uses: jakejarvis/wait-action@master | |
with: | |
time: '20s' | |
# Print some debugging | |
- name: Check running containers | |
run: docker ps -a | |
- name: Check docker logs | |
run: docker logs wikmd | |
# Check that wikmd is up and running | |
- name: Assert wikmd status | |
run: curl -I localhost:5000 2>&1 | awk '/HTTP\// {print $2}' | grep -w "200\|301" | |
# Check that wikmd is rendering | |
- name: Check wikmd rendering status | |
run: curl -s localhost:5000 | grep -w "What is it?" | |
publish: | |
# Publish if official repo and push to 'main' or new tag | |
if: | | |
github.repository == 'Linbreux/wikmd' && | |
(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) | |
runs-on: ubuntu-latest | |
needs: [build, test] | |
steps: | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Publish | |
uses: docker/build-push-action@v3 | |
with: | |
file: Dockerfile | |
push: true | |
tags: ${{ needs.build.outputs.wikmd_tags }} |