.github/workflows/release.yml #28
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
on: | |
push: | |
branches: [ "main" ] | |
tags: [ "*" ] | |
schedule: | |
- cron: "0 10 * * 1" | |
env: | |
REGISTRY: "ghcr.io" | |
IMAGE_NAME: "${{ github.repository }}" | |
jobs: | |
build: | |
strategy: | |
matrix: | |
include: | |
- ats_version: 9.2.2 | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install build dependencies | |
run: sudo ./tool/setup-debian.sh | |
- name: Build ATS | |
run: make -j$(nproc) -C "trafficserver" TRAFFICSERVER_VERSION="${{ matrix.ats_version }}" TRAFFICSERVER_RUN_TESTS=false | |
- name: Archive dist | |
uses: actions/upload-artifact@v3 | |
with: | |
name: trafficserver-${{ matrix.ats_version }}.tar.gz | |
path: trafficserver/trafficserver-dist.tar.gz | |
docker: | |
needs: [ "build" ] | |
strategy: | |
matrix: | |
include: | |
- ats_version: 9.2.2 | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Download ATS version dist | |
uses: actions/download-artifact@v3 | |
with: | |
name: trafficserver-${{ matrix.ats_version }}.tar.gz | |
path: trafficserver/trafficserver-dist-${{ matrix.ats_version }}.tar.gz | |
# Brainworms | |
- name: Decompress Gzipped tarball | |
run: | | |
cd trafficserver | |
ls -al | |
FILENAME="trafficserver-dist-${{ matrix.ats_version }}.tar.gz" | |
if file $FILENAME | grep -i 'zip archive'; then | |
echo "Zipfile found, decompressing it" | |
unzip $FILENAME | |
rm -v $FILENAME | |
elif [ -d "$FILENAME" ]; then | |
echo "Artifact is a directory, copying underlying file" | |
mv -fv $FILENAME/trafficserver-dist.tar.gz ./trafficserver-dist.tar.gz | |
rm -rfv $FILENAME | |
else | |
echo "Non-directory non-zip file found, rename and pray, because those actions are shit" | |
mv -fv $FILENAME trafficserver-dist.tar.gz | |
fi | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=sha,event=push,enable=true,prefix=branch-{{ branch }}-${{ matrix.ats_version }}-git-,format=short | |
type=sha,event=push,enable={{ is_default_branch }},prefix=${{ matrix.ats_version }}-,format=short | |
type=raw,event=push,enable={{ is_default_branch }},value=${{ matrix.ats_version }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
target: ${{ matrix.target }} |