Skip to content

fix: incorrect var name #191

fix: incorrect var name

fix: incorrect var name #191

Workflow file for this run

name: build
on:
push:
branches:
- master
schedule:
- cron: '0 3 * * SUN'
workflow_dispatch:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Lint Dockerfiles with hadolint
run: |
docker pull hadolint/hadolint:latest
error_file=$(mktemp)
find . -type f -print0 | grep -z -E 'Dockerfile(\..*)?$' | while IFS= read -r -d '' file; do
echo "Running hadolint on $file . . ."
if ! docker run --rm -i hadolint/hadolint < "$file"; then
echo "error" >> "$error_file"
fi
done
if [ -s "$error_file" ]; then
echo "Hadolint found errors."
rm "$error_file"
exit 1
fi
rm "$error_file"
- name: Lint shell scripts with ShellCheck
run: |
docker pull koalaman/shellcheck:latest
error_found=0
find . -type f -not -path './.*' -exec grep -Iq '^#!.*sh' {} \; -print0 | while IFS= read -r -d '' file; do
echo "Running shellcheck on $file . . ."
if ! docker run --rm -v "$PWD:/scripts" koalaman/shellcheck "/scripts/$file"; then
error_found=1
fi
done
if [ "$error_found" -ne 0 ]; then
echo "ShellCheck found errors."
exit 1
fi
build_and_push:
runs-on: ubuntu-latest
needs: lint
strategy:
matrix:
include:
- wine_branch: stable
wine_major_version: 8
platforms: |
linux/amd64,
linux/arm64
- wine_branch: devel
wine_major_version: 8
platforms: |
linux/amd64,
linux/arm64
- wine_branch: stable
wine_major_version: 9
platforms: linux/amd64
- wine_branch: devel
wine_major_version: 9
platforms: linux/amd64
- wine_branch: stable
wine_major_version: 10
platforms: linux/amd64
- wine_branch: devel
wine_major_version: 10
platforms: linux/amd64
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: Determine wine version to install from major version
id: wine_install_version
run: |
WINE_BRANCH=${{ matrix.wine_branch }}
WINE_MAJOR_VERSION=${{ matrix.wine_major_version }}
ID="debian"
DIST="bookworm"
URL="https://dl.winehq.org/wine-builds/${ID}/dists/${DIST}/main/binary-amd64/"
if [ "${WINE_MAJOR_VERSION}" = "latest" ]; then
WINE_INSTALL_VERSION=$(wget -qO- "${URL}" | sed -E "s/></>\n</g" | sed -n -E "s|^.*<a href=\"wine-${WINE_BRANCH}_([0-9]+(\.[0-9]+)*).*\.deb\">.*|\1|p" | sort -rV | head -1)
else
WINE_INSTALL_VERSION=$(wget -qO- "${URL}" | sed -E "s/></>\n</g" | sed -n -E "s|^.*<a href=\"wine-${WINE_BRANCH}_([0-9]+(\.[0-9]+)*).*\.deb\">.*|\1|p" | grep -E "^${WINE_MAJOR_VERSION}" | sort -rV | head -1)
fi
echo "WINE_INSTALL_VERSION=${WINE_INSTALL_VERSION}" | tee -a "$GITHUB_OUTPUT"
- name: Build and export amd64 container to local Docker instance
uses: docker/build-push-action@v4
with:
platforms: linux/amd64
build-args: |
WINE_BRANCH=${{ matrix.wine_branch }}
WINE_VERSION=${{ steps.wine_install_version.outputs.WINE_INSTALL_VERSION }}
load: true
tags: docker-wine:amd64
- name: Test amd64 container
run: |
./docker-wine --local --tag=amd64 --rm --xvfb --notty winetricks -q winamp
- name: Build and export arm64 container to local Docker instance
if: contains(matrix.platforms, 'linux/arm64')
uses: docker/build-push-action@v4
with:
platforms: linux/arm64
build-args: |
WINE_BRANCH=${{ matrix.wine_branch }}
WINE_VERSION=${{ steps.wine_install_version.outputs.WINE_INSTALL_VERSION }}
load: true
tags: docker-wine:arm64
- name: Test arm64 container
if: contains(matrix.platforms, 'linux/arm64')
run: |
./docker-wine --local --tag=arm64 --rm --xvfb --notty winetricks -q winamp
- name: Extract wine version from container
id: wine_version
env:
WINE_BRANCH: ${{ matrix.wine_branch }}
run: |
WINE_VERSION="$(docker run --rm docker-wine:amd64 /bin/bash -c "wine --version | sed -E 's/^wine-//'")"
echo "WINE_VERSION=${WINE_VERSION}" | tee -a "$GITHUB_OUTPUT"
- name: Generate timestamp
id: timestamp
run: |
echo "TIMESTAMP=$(date +"%Y%m%d")" | tee -a "$GITHUB_OUTPUT"
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Generate tags
id: tags
run: |
TAGS_ARRAY=(
"scottyhardy/docker-wine:${{ matrix.wine_branch }}-${{ matrix.wine_major_version }}"
"scottyhardy/docker-wine:${{ matrix.wine_branch }}-${{ steps.wine_version.outputs.WINE_VERSION }}"
"scottyhardy/docker-wine:${{ matrix.wine_branch }}-${{ steps.wine_version.outputs.WINE_VERSION }}-${{ steps.timestamp.outputs.TIMESTAMP }}"
)
if [ "${{ matrix.wine_major_version }}" = "8" ]; then
TAGS_ARRAY+=("scottyhardy/docker-wine:${{ matrix.wine_branch }}")
fi
if [ "${{ matrix.wine_major_version }}" = "8" ] && [ "${{ matrix.wine_branch }}" = "stable" ]; then
TAGS_ARRAY+=(
"scottyhardy/docker-wine:latest"
)
fi
TAGS=$(IFS=,; echo "${TAGS_ARRAY[*]}")
echo "TAGS=${TAGS}" | tee -a "$GITHUB_OUTPUT"
- name: Build and push
id: docker_build
uses: docker/build-push-action@v4
with:
build-args: |
WINE_BRANCH=${{ matrix.wine_branch }}
WINE_VERSION=${{ steps.wine_install_version.outputs.WINE_INSTALL_VERSION }}
platforms: ${{ matrix.platforms }}
push: true
tags: ${{ steps.tags.outputs.TAGS }}
- name: Update Docker Hub repository description
uses: peter-evans/dockerhub-description@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
repository: scottyhardy/docker-wine