Update .gitea/workflows/image-publish.yml
Some checks failed
Build and Push Docker Image / docker (push) Has been cancelled
Some checks failed
Build and Push Docker Image / docker (push) Has been cancelled
This commit is contained in:
@@ -8,28 +8,32 @@ on:
|
||||
|
||||
jobs:
|
||||
docker:
|
||||
runs-on: ubuntu
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y git docker.io
|
||||
|
||||
- name: Clone repository
|
||||
run: |
|
||||
git clone ${{ github.server_url }}/${{ github.repository }} repo
|
||||
cd repo
|
||||
git checkout ${{ github.sha }}
|
||||
|
||||
- name: Generate tags
|
||||
id: vars
|
||||
run: |
|
||||
cd repo
|
||||
echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
|
||||
echo "BUILD_DATE=$(date -u +'%Y%m%d-%H%M%S')" >> $GITHUB_ENV
|
||||
|
||||
- name: Login to Gitea Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ github.server_url }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITEA_TOKEN }}
|
||||
run: |
|
||||
echo "${{ secrets.GITEA_TOKEN }}" | docker login \
|
||||
${{ github.server_url }} \
|
||||
-u "${{ github.actor }}" \
|
||||
--password-stdin
|
||||
|
||||
- name: Set image name
|
||||
run: |
|
||||
@@ -38,20 +42,16 @@ jobs:
|
||||
|
||||
- name: Build Docker image
|
||||
run: |
|
||||
cd repo
|
||||
|
||||
docker build \
|
||||
-t ${{ github.server_url }}/${IMAGE_NAME}:latest \
|
||||
-t ${{ github.server_url }}/${IMAGE_NAME}:${SHORT_SHA} \
|
||||
-t ${{ github.server_url }}/${IMAGE_NAME}:${BUILD_DATE} \
|
||||
.
|
||||
|
||||
- name: Push latest tag
|
||||
- name: Push images
|
||||
run: |
|
||||
docker push ${{ github.server_url }}/${IMAGE_NAME}:latest
|
||||
|
||||
- name: Push commit hash tag
|
||||
run: |
|
||||
docker push ${{ github.server_url }}/${IMAGE_NAME}:${SHORT_SHA}
|
||||
|
||||
- name: Push datetime tag
|
||||
run: |
|
||||
docker push ${{ github.server_url }}/${IMAGE_NAME}:${BUILD_DATE}
|
||||
Reference in New Issue
Block a user