[UPD] added extended CI and builds; #1
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: 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 | ||
platforms: linux/amd64,linux/arm64 | ||
- 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: 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 | ||
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 }} |