Compare commits
1 Commits
c920d9ed8f
...
530f84bc8c
| Author | SHA1 | Date | |
|---|---|---|---|
| 530f84bc8c |
@ -1,73 +1,42 @@
|
|||||||
name: Build
|
name: build-docker-image
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- '**'
|
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- '*'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build Docker Image
|
|
||||||
runs-on: almalinux-8
|
runs-on: almalinux-8
|
||||||
services:
|
container:
|
||||||
docker:
|
image: docker:dind
|
||||||
image: docker:dind
|
options: --privileged
|
||||||
options: --privileged
|
volumes:
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Set up Docker Buildx
|
- name: Set up environment
|
||||||
uses: docker/setup-buildx-action@v2
|
|
||||||
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
run: |
|
||||||
apk add --no-cache make bash git
|
apk add --no-cache make bash git
|
||||||
|
|
||||||
- name: Build Docker image
|
- name: Build Docker Image
|
||||||
if: github.event_name == 'pull_request'
|
|
||||||
run: |
|
run: |
|
||||||
make build
|
make build
|
||||||
|
|
||||||
- name: Save Docker context
|
push:
|
||||||
if: github.event_name == 'pull_request'
|
|
||||||
run: tar -czf build-context.tar.gz .
|
|
||||||
|
|
||||||
- name: Upload build artifacts
|
|
||||||
if: github.event_name == 'pull_request'
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: build-context
|
|
||||||
path: build-context.tar.gz
|
|
||||||
|
|
||||||
deploy:
|
|
||||||
name: Deploy Docker Image
|
|
||||||
runs-on: almalinux-8
|
|
||||||
needs: build
|
|
||||||
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
|
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
|
||||||
services:
|
runs-on: almalinux-8
|
||||||
docker:
|
container:
|
||||||
image: docker:dind
|
image: docker:dind
|
||||||
options: --privileged
|
options: --privileged
|
||||||
|
volumes:
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Set up Docker Buildx
|
- name: Set up environment
|
||||||
uses: docker/setup-buildx-action@v2
|
|
||||||
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Download build artifacts
|
|
||||||
uses: actions/download-artifact@v3
|
|
||||||
with:
|
|
||||||
name: build-context
|
|
||||||
|
|
||||||
- name: Extract build artifacts
|
|
||||||
run: tar -xzf build-context.tar.gz
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
run: |
|
||||||
apk add --no-cache make bash git
|
apk add --no-cache make bash git
|
||||||
|
|
||||||
@ -75,8 +44,26 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
UPLOAD_USER: ${{ secrets.UPLOAD_USER }}
|
UPLOAD_USER: ${{ secrets.UPLOAD_USER }}
|
||||||
UPLOAD_PASS: ${{ secrets.UPLOAD_PASS }}
|
UPLOAD_PASS: ${{ secrets.UPLOAD_PASS }}
|
||||||
run: echo "${{ secrets.UPLOAD_PASS }}" | docker login --username "${{ secrets.UPLOAD_USER }}" --password-stdin git.query.consul
|
run: |
|
||||||
|
echo "$UPLOAD_PASS" | docker login --username=$UPLOAD_USER --password-stdin git.query.consul
|
||||||
|
|
||||||
- name: Push Docker image
|
- name: Push Docker Image
|
||||||
run: |
|
run: |
|
||||||
make push
|
make push
|
||||||
|
|
||||||
|
clean:
|
||||||
|
runs-on: almalinux-8
|
||||||
|
container:
|
||||||
|
image: docker:dind
|
||||||
|
options: --privileged
|
||||||
|
volumes:
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Set up environment
|
||||||
|
run: |
|
||||||
|
apk add --no-cache make bash git
|
||||||
|
|
||||||
|
- name: Clean Up
|
||||||
|
run: |
|
||||||
|
make clean
|
||||||
|
|||||||
Reference in New Issue
Block a user