Renamed pipeline from "Build and Push to Registry" to "Build Image". Dropped the registry login/push/logout steps (needed secrets that don't exist on the new instance) and the hardcoded git clone against gitea.servernah.com in favor of actions/checkout, which works regardless of which Gitea instance runs it. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,36 +1,24 @@
|
|||||||
name: Build and Push to Registry
|
name: Build Image
|
||||||
on: [push]
|
on: [push]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-push:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
run: |
|
uses: actions/checkout@v4
|
||||||
git clone https://gitea.servernah.com/${{ gitea.repository }} .
|
|
||||||
|
|
||||||
- name: Log in to Custom Registry
|
|
||||||
run: |
|
|
||||||
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login ${{ secrets.REGISTRY_URL }} -u "${{ secrets.REGISTRY_USERNAME }}" --password-stdin
|
|
||||||
|
|
||||||
- name: Set up Docker Tags
|
- name: Set up Docker Tags
|
||||||
id: vars
|
id: vars
|
||||||
run: |
|
run: |
|
||||||
# Use the short git commit hash as a tag
|
# Use the short git commit hash as a tag
|
||||||
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
echo "sha_short=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
|
||||||
# Define the full image name
|
echo "image_path=devops-website" >> "$GITHUB_OUTPUT"
|
||||||
echo "image_path=${{ secrets.REGISTRY_URL }}/servernah/devops-website" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Build Docker Image
|
- name: Build Docker Image
|
||||||
run: |
|
run: |
|
||||||
docker build -t ${{ steps.vars.outputs.image_path }}:${{ steps.vars.outputs.sha_short }} .
|
docker build -t ${{ steps.vars.outputs.image_path }}:${{ steps.vars.outputs.sha_short }} .
|
||||||
docker tag ${{ steps.vars.outputs.image_path }}:${{ steps.vars.outputs.sha_short }} ${{ steps.vars.outputs.image_path }}:latest
|
docker tag ${{ steps.vars.outputs.image_path }}:${{ steps.vars.outputs.sha_short }} ${{ steps.vars.outputs.image_path }}:latest
|
||||||
|
|
||||||
- name: Push Image to Registry
|
- name: Show built image
|
||||||
run: |
|
run: docker images ${{ steps.vars.outputs.image_path }}
|
||||||
docker push ${{ steps.vars.outputs.image_path }}:${{ steps.vars.outputs.sha_short }}
|
|
||||||
docker push ${{ steps.vars.outputs.image_path }}:latest
|
|
||||||
|
|
||||||
- name: Cleanup
|
|
||||||
if: always()
|
|
||||||
run: docker logout ${{ secrets.REGISTRY_URL }}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user