Skip to content

[FIX] id restrictions; #4

[FIX] id restrictions;

[FIX] id restrictions; #4

name: ci-builds-and-releases
on:
push:
branches:
- main
release:
types:
- created
schedule:
- cron: "0 0 * * *"
jobs:
docker_build:
name: Build and Push Docker Image
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Get short SHA
id: vars
run: echo "SHORT_SHA=${GITHUB_SHA::8}" >> $GITHUB_ENV
- name: Get repo name
id: repo_vars
run: echo "GH_REPO_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
- name: Build and Push Docker Image
uses: docker/build-push-action@v6
with:
context: .
tags: ${{ secrets.DOCKER_USERNAME }}/${{ env.GH_REPO_NAME }}:${{ env.SHORT_SHA }}
push: true
platforms: 'linux/amd64,linux/arm64'
labels: ${{ github.github_repository }}
release:
name: Create GitHub Release
runs-on: ubuntu-20.04
needs: docker_build
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get last 4 commits
id: last_commits
run: |
git log -4 --pretty=format:"- %s (%h)" > last_commits.txt
echo "LAST_COMMITS=$(cat last_commits.txt)" >> $GITHUB_ENV
- name: Upload source code to GitHub Release
uses: softprops/action-gh-release@v2
with:
body: ${{ env.LAST_COMMITS }}