mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
![dependabot[bot]](/assets/img/avatar_default.png)
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.5 to 4.1.7. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v4.1.5...v4.1.7) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
95 lines
3.3 KiB
YAML
95 lines
3.3 KiB
YAML
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@v4.1.7
|
|
- 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@v5
|
|
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@v5
|
|
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@v4.1.7
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
- name: Login to DockerHub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
- name: Build and export to docker
|
|
uses: docker/build-push-action@v5
|
|
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@v5
|
|
with:
|
|
context: .
|
|
push: true
|
|
platforms: linux/amd64
|
|
tags: ${{ needs.docker-meta.outputs.tags }}
|
|
labels: ${{ needs.docker-meta.outputs.labels }}
|