Add Gitea Actions workflow to build and upload Docker image

This commit is contained in:
Alex Borisov 2024-01-29 20:24:39 +03:00
parent e0737b04dc
commit a72536e38f

View File

@ -1,15 +1,19 @@
name: Actions Build Docker Image name: Actions Build Docker Image
run-name: ${{ gitea.actor }} is building new image 🚀 run-name: ${{ gitea.actor }} is building new image 🚀
on: push on: [push]
jobs: jobs:
build: Explore-Gitea-Actions:
runs-on: soaska runs-on: soaska
steps: steps:
- run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event." - run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event."
- run: apk add --no-cache nodejs - run: apk add --no-cache nodejs
- name: Check out repository code - name: Check out repository code
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: List files in the repository
run: |
ls ${{ gitea.workspace }}
- run: echo "🍏 This job's status is ${{ job.status }}."
- name: Install Docker - name: Install Docker
run: | run: |
apk add --no-cache docker apk add --no-cache docker
@ -17,16 +21,17 @@ jobs:
run: | run: |
dockerd & dockerd &
sleep 5 sleep 5
docker info docker info
- name: Build Dockerfile - name: Build Dockerfile
run: | run: |
docker build -t sd_telegram . docker build -t sd_telegram .
- name: Export Docker image to tar.gz - name: Export Docker image to tar.gz
run: | run: |
docker save sd_telegram | gzip > sd_telegram.tar.gz docker save sd_telegram | gzip > sd_telegram.tar.gz
- name: Upload Docker image to Gitea - name: Upload Docker image to Gitea
run: | run: |
- name: Upload Docker image to Gitea - name: Upload Docker image to Gitea
run: | run: |
package_name=$(basename ${{ github.repository }})
commit_date=$(git log -1 --format=%cd --date=format:'%Y%m%d%H%M%S') commit_date=$(git log -1 --format=%cd --date=format:'%Y%m%d%H%M%S')
curl -u ${{ secrets.username }}:${{ secrets.password }} -X POST -F "file=@sd_telegram.tar.gz" https://soaska.ru/packages/${{ sd_telegram_image }}/versions/${{ commit_date }} curl -u ${{ secrets.username }}:${{ secrets.password }} -X POST -F "file=@sd_telegram.tar.gz" https://soaska.ru/packages/${{ package_name }}/versions/${{ commit_date }}