Update build.yml
This commit is contained in:
parent
7ff3297440
commit
232e0eed8e
1 changed files with 29 additions and 6 deletions
35
.github/workflows/build.yml
vendored
35
.github/workflows/build.yml
vendored
|
@ -11,10 +11,10 @@ on:
|
||||||
- '.github/workflows/**'
|
- '.github/workflows/**'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check:
|
shellcheck:
|
||||||
uses: ./.github/workflows/check.yml
|
uses: ./.github/workflows/check.yml
|
||||||
build:
|
build:
|
||||||
needs: check
|
needs: shellcheck
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
packages: write
|
packages: write
|
||||||
|
@ -23,7 +23,18 @@ jobs:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
-
|
-
|
||||||
name: Build the Docker image
|
name: Build the Docker image
|
||||||
run: docker build . --file Dockerfile --build-arg "VERSION_ARG=${{ secrets.MAJOR }}.${{ secrets.MINOR }}" --build-arg "BUILD_ARG=${GITHUB_RUN_ID}" --label "id=${GITHUB_RUN_ID}" --label "version=${{ secrets.MAJOR }}.${{ secrets.MINOR }}" --tag "${{ github.repository }}:latest" --tag "${{ github.repository }}:${{ secrets.MAJOR }}.${{ secrets.MINOR }}" --tag "ghcr.io/${{ github.repository }}:latest" --tag "ghcr.io/${{ github.repository }}:${{ secrets.MAJOR }}.${{ secrets.MINOR }}"
|
run: |
|
||||||
|
docker build . \
|
||||||
|
--file Dockerfile \
|
||||||
|
--build-arg "VERSION_ARG=${{ secrets.MAJOR }}.${{ secrets.MINOR }}" \
|
||||||
|
--build-arg "BUILD_ARG=${GITHUB_RUN_ID}" \
|
||||||
|
--build-arg "DATE_ARG=${{ github.event.repository.updated_at }}" \
|
||||||
|
--label "build=${GITHUB_RUN_ID}" \
|
||||||
|
--label "version=${{ secrets.MAJOR }}.${{ secrets.MINOR }}" \
|
||||||
|
--tag "${{ github.repository }}:latest" \
|
||||||
|
--tag "${{ github.repository }}:${{ secrets.MAJOR }}.${{ secrets.MINOR }}" \
|
||||||
|
--tag "ghcr.io/${{ github.repository }}:latest" \
|
||||||
|
--tag "ghcr.io/${{ github.repository }}:${{ secrets.MAJOR }}.${{ secrets.MINOR }}"
|
||||||
-
|
-
|
||||||
name: Update Minor version
|
name: Update Minor version
|
||||||
uses: hmanzur/actions-set-secret@v2.0.0
|
uses: hmanzur/actions-set-secret@v2.0.0
|
||||||
|
@ -32,6 +43,14 @@ jobs:
|
||||||
value: $((${{ secrets.MINOR }}+1))
|
value: $((${{ secrets.MINOR }}+1))
|
||||||
repository: ${{ github.repository }}
|
repository: ${{ github.repository }}
|
||||||
token: ${{ secrets.REPO_ACCESS_TOKEN }}
|
token: ${{ secrets.REPO_ACCESS_TOKEN }}
|
||||||
|
-
|
||||||
|
name: Create tag
|
||||||
|
uses: rickstaa/action-create-tag@v1
|
||||||
|
id: "tag_create"
|
||||||
|
with:
|
||||||
|
tag: "v${{ secrets.MAJOR }}.${{ secrets.MINOR }}"
|
||||||
|
tag_exists_error: false
|
||||||
|
message: "Release v${{ secrets.MAJOR }}.${{ secrets.MINOR }}"
|
||||||
-
|
-
|
||||||
name: Login to Docker Hub
|
name: Login to Docker Hub
|
||||||
uses: docker/login-action@v2
|
uses: docker/login-action@v2
|
||||||
|
@ -40,7 +59,9 @@ jobs:
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
-
|
-
|
||||||
name: Push to DockerHub
|
name: Push to DockerHub
|
||||||
run: docker push "${{ github.repository }}:${{ secrets.MAJOR }}.${{ secrets.MINOR }}" && docker push "${{ github.repository }}:latest"
|
run: |
|
||||||
|
docker push "${{ github.repository }}:${{ secrets.MAJOR }}.${{ secrets.MINOR }}" &&\
|
||||||
|
docker push "${{ github.repository }}:latest"
|
||||||
-
|
-
|
||||||
name: Login to GitHub Container Registry
|
name: Login to GitHub Container Registry
|
||||||
uses: docker/login-action@v2
|
uses: docker/login-action@v2
|
||||||
|
@ -50,7 +71,9 @@ jobs:
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
-
|
-
|
||||||
name: Push to Github Container Registry
|
name: Push to Github Container Registry
|
||||||
run: docker push "ghcr.io/${{ github.repository }}:${{ secrets.MAJOR }}.${{ secrets.MINOR }}" && docker push "ghcr.io/${{ github.repository }}:latest"
|
run: |
|
||||||
|
docker push "ghcr.io/${{ github.repository }}:${{ secrets.MAJOR }}.${{ secrets.MINOR }}" && \
|
||||||
|
docker push "ghcr.io/${{ github.repository }}:latest"
|
||||||
mirror:
|
mirror:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
|
@ -64,5 +87,5 @@ jobs:
|
||||||
uses: wangchucheng/git-repo-sync@v0.1.0
|
uses: wangchucheng/git-repo-sync@v0.1.0
|
||||||
with:
|
with:
|
||||||
target-url: ${{ secrets.GITLAB_URL }}
|
target-url: ${{ secrets.GITLAB_URL }}
|
||||||
target-username: ${{ secrets.GITLAB_USERNAME }}
|
|
||||||
target-token: ${{ secrets.GITLAB_TOKEN }}
|
target-token: ${{ secrets.GITLAB_TOKEN }}
|
||||||
|
target-username: ${{ secrets.GITLAB_USERNAME }}
|
||||||
|
|
Loading…
Reference in a new issue