Skip to content

Remove hyphen from default user #36

Remove hyphen from default user

Remove hyphen from default user #36

Workflow file for this run

name: Build
on:
- push
- pull_request
env:
NAME: tagesschau-eilbot
jobs:
build:
name: build
runs-on: ubuntu-latest
strategy:
matrix:
GOOS: [windows, linux, darwin]
GOARCH: [amd64, 386, arm, arm64]
exclude:
- GOOS: windows
GOARCH: arm
- GOOS: darwin
GOARCH: 386
- GOOS: darwin
GOARCH: arm
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Build
env:
GOOS: ${{ matrix.GOOS }}
GOARCH: ${{ matrix.GOARCH }}
run: go build -ldflags="-s -w" -o dist/$NAME-$GOOS-$GOARCH
- name: Rename binaries (Windows)
if: matrix.GOOS == 'windows'
run: for x in dist/$NAME-windows-*; do mv $x $x.exe; done
- name: Upload binary
uses: actions/upload-artifact@v4
with:
name: ${{env.NAME}}-${{ matrix.GOOS }}-${{ matrix.GOARCH }}-${{github.sha}}
path: dist/*
retention-days: 90
docker:
name: docker
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v4
- name: Build image
run: docker build . --file Dockerfile --tag $NAME --label "runnumber=${GITHUB_RUN_ID}"
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
- name: Push image
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$NAME
# This changes all uppercase characters to lowercase.
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# This strips the git ref prefix from the version.
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# This strips the "v" prefix from the tag name.
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# This uses the Docker `latest` tag convention.
[ "$VERSION" == "master" ] && VERSION=latest
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION