mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
ci: split up into multiple workflows
* ci: split up workflows * ci: tweaks and housekeeping * ci: additional comments and requested changes * ci: additional comments * chore: clean up .gitignore
This commit is contained in:
94
.github/workflows/docker.yml
vendored
Normal file
94
.github/workflows/docker.yml
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
name: Docker
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
secrets:
|
||||
DOCKERHUB_TOKEN:
|
||||
required: true
|
||||
DOCKERHUB_USERNAME:
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
|
||||
docker-meta:
|
||||
# Generates the metadata (labels and tags) for the docker containers
|
||||
# - push to main results in the edge tag
|
||||
# - version tag results in edge, latest and semver, major, major.minor tags
|
||||
# - push to versions/ results in the next tag
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
labels: ${{ steps.meta-main.outputs.labels || steps.meta-version.outputs.labels }}
|
||||
tags: ${{ steps.meta-main.outputs.tags || steps.meta-version.outputs.tags }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- if: startsWith(github.ref, 'refs/tags/v') || (github.ref == 'refs/heads/main')
|
||||
name: Docker meta edge and version tag
|
||||
id: meta-main
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: |
|
||||
solidproject/community-server
|
||||
# edge will always be executed (without latest tag), semver only on tag push events (with latest tag)
|
||||
tags: |
|
||||
type=edge
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=semver,pattern={{major}}
|
||||
github-token: ${{ secrets.github_token }}
|
||||
- if: startsWith(github.ref, 'refs/heads/versions/')
|
||||
name: Docker meta next
|
||||
id: meta-version
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: |
|
||||
solidproject/community-server
|
||||
# Just one label: next (no latest here) for the last pushed commit on this branch
|
||||
tags: |
|
||||
type=raw,value=next
|
||||
github-token: ${{ secrets.github_token }}
|
||||
|
||||
docker:
|
||||
# Builds, tests and pushes docker containers
|
||||
# Containers are built for both linux/amd64 and linux/arm/v7 platforms
|
||||
needs: docker-meta
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
- 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: Build and export to docker
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: .
|
||||
load: true
|
||||
tags: ${{ needs.docker-meta.outputs.tags }}
|
||||
labels: ${{ needs.docker-meta.outputs.labels }}
|
||||
|
||||
- name: "Test all docker-built image tags"
|
||||
shell: bash
|
||||
# Loop over all generated image:tag names and docker run them.
|
||||
# If they aren't built previously, the command will error.
|
||||
# If they don't work, the job will fail.
|
||||
# If they work the --version argument should return a version and the job succeeds.
|
||||
run: |
|
||||
while read i; do
|
||||
docker run --rm --pull never $i --version
|
||||
done <<< "${{ needs.docker-meta.outputs.tags }}";
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm/v7
|
||||
tags: ${{ needs.docker-meta.outputs.tags }}
|
||||
labels: ${{ needs.docker-meta.outputs.labels }}
|
||||
Reference in New Issue
Block a user