Compare commits
1 Commits
c920d9ed8f
...
530f84bc8c
| Author | SHA1 | Date | |
|---|---|---|---|
| 530f84bc8c |
@ -1,73 +1,42 @@
|
||||
name: Build
|
||||
name: build-docker-image
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- '**'
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
branches:
|
||||
- '*'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build Docker Image
|
||||
runs-on: almalinux-8
|
||||
services:
|
||||
docker:
|
||||
image: docker:dind
|
||||
options: --privileged
|
||||
container:
|
||||
image: docker:dind
|
||||
options: --privileged
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
|
||||
steps:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install dependencies
|
||||
- name: Set up environment
|
||||
run: |
|
||||
apk add --no-cache make bash git
|
||||
|
||||
- name: Build Docker image
|
||||
if: github.event_name == 'pull_request'
|
||||
- name: Build Docker Image
|
||||
run: |
|
||||
make build
|
||||
|
||||
- name: Save Docker context
|
||||
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
|
||||
push:
|
||||
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
|
||||
services:
|
||||
docker:
|
||||
image: docker:dind
|
||||
options: --privileged
|
||||
runs-on: almalinux-8
|
||||
container:
|
||||
image: docker:dind
|
||||
options: --privileged
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
|
||||
steps:
|
||||
- name: Set up Docker Buildx
|
||||
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
|
||||
- name: Set up environment
|
||||
run: |
|
||||
apk add --no-cache make bash git
|
||||
|
||||
@ -75,8 +44,26 @@ jobs:
|
||||
env:
|
||||
UPLOAD_USER: ${{ secrets.UPLOAD_USER }}
|
||||
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: |
|
||||
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