⬆ Bump docker/login-action from 3.2.0 to 3.3.0 #164
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
name: Service | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
env: | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
DOTNET_CLI_TELEMETRY_OPTOUT: true | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/[email protected] | |
- name: Setup .NET | |
uses: actions/[email protected] | |
with: | |
dotnet-version: "8.0.x" | |
- name: Lint dotnet | |
run: dotnet format --verify-no-changes --verbosity diagnostic --exclude-diagnostics IL3050 IL2026 | |
build: | |
runs-on: ubuntu-latest | |
needs: lint | |
steps: | |
- name: Checkout repository | |
uses: actions/[email protected] | |
- name: Log into registry | |
uses: docker/[email protected] | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build image | |
run: | | |
githubRepositoryLowerCase=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') | |
IMAGE_ID=ghcr.io/${githubRepositoryLowerCase} | |
TAG=$(date +%Y%m%d).${{ github.run_number }} | |
echo IMAGE_ID=$IMAGE_ID | |
echo TAG=$TAG | |
docker pull $IMAGE_ID:latest | |
docker build . --file Dockerfile --tag $IMAGE_ID:$TAG --tag $IMAGE_ID:latest --cache-from $IMAGE_ID:latest | |
- name: Enable Automerge | |
if: github.event_name == 'pull_request' | |
run: gh pr merge --auto --rebase "$PR_URL" | |
env: | |
PR_URL: ${{ github.event.pull_request.html_url }} | |
GH_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
- name: Approve | |
if: github.event_name == 'pull_request' | |
run: gh pr review --approve "${{ github.event.pull_request.number }}" | |
env: | |
GH_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
- name: Push image | |
if: github.event_name == 'push' | |
run: | | |
githubRepositoryLowerCase=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') | |
IMAGE_ID=ghcr.io/${githubRepositoryLowerCase} | |
docker push --all-tags $IMAGE_ID | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
if: github.event_name == 'push' | |
steps: | |
- uses: actions/[email protected] | |
with: | |
repository: "MarkusRodler/dark-server" | |
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
- name: Bump version | |
run: | | |
REPOSITORY=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') | |
TAG=$(date +%Y%m%d).${{ github.run_number }} | |
echo REPOSITORY=$REPOSITORY | |
echo TAG=$TAG | |
sed -i -E "s|$REPOSITORY:[0-9]+\.[0-9]+$|$REPOSITORY:$TAG|" Repository/RepositoryService.yaml | |
- name: Push version | |
run: | | |
TAG=$(date +%Y%m%d).${{ github.run_number }} | |
echo TAG=$TAG | |
git config user.name ${{ secrets.GIT_USER_NAME }} | |
git config user.email ${{ secrets.GIT_USER_EMAIL }} | |
git add . | |
git commit -m "Bump Repository Service to $TAG" | |
git push || echo "No changes to commit" |