mirror of
https://github.com/vitodeploy/vito.git
synced 2025-04-20 02:11:36 +00:00
github actions
This commit is contained in:
parent
321465d3e2
commit
54dc6cfb9a
34
.github/workflows/docker-2x.yml
vendored
34
.github/workflows/docker-2x.yml
vendored
@ -1,34 +0,0 @@
|
|||||||
name: Build and push Docker image
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- 2.x
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-and-push:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v1
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v1
|
|
||||||
|
|
||||||
- name: Login to Docker Hub
|
|
||||||
uses: docker/login-action@v2
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
||||||
|
|
||||||
- name: Build and push Docker image
|
|
||||||
run: |
|
|
||||||
docker buildx build . \
|
|
||||||
-f docker/Dockerfile \
|
|
||||||
-t vitodeploy/vito:2.x \
|
|
||||||
--platform linux/amd64,linux/arm64 \
|
|
||||||
--no-cache \
|
|
||||||
--push
|
|
13
.github/workflows/docker-release.yml
vendored
13
.github/workflows/docker-release.yml
vendored
@ -2,7 +2,7 @@ name: Build and push Docker image
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
release:
|
release:
|
||||||
types: [created]
|
types: [ created ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-push:
|
build-and-push:
|
||||||
@ -28,8 +28,17 @@ jobs:
|
|||||||
docker buildx build . \
|
docker buildx build . \
|
||||||
-f docker/Dockerfile \
|
-f docker/Dockerfile \
|
||||||
-t vitodeploy/vito:${{ github.event.release.tag_name }} \
|
-t vitodeploy/vito:${{ github.event.release.tag_name }} \
|
||||||
-t vitodeploy/vito:latest \
|
|
||||||
--build-arg="RELEASE=0" \
|
--build-arg="RELEASE=0" \
|
||||||
--platform linux/amd64,linux/arm64 \
|
--platform linux/amd64,linux/arm64 \
|
||||||
--no-cache \
|
--no-cache \
|
||||||
--push
|
--push
|
||||||
|
|
||||||
|
- name: Build and push latest tag
|
||||||
|
if: startsWith(github.event.release.target_commitish, '1.x')
|
||||||
|
run: |
|
||||||
|
docker buildx build . \
|
||||||
|
-f docker/Dockerfile \
|
||||||
|
-t vitodeploy/vito:latest \
|
||||||
|
--build-arg="RELEASE=0" \
|
||||||
|
--platform linux/amd64,linux/arm64 \
|
||||||
|
--push
|
||||||
|
@ -4,6 +4,7 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- 1.x
|
- 1.x
|
||||||
|
- 2.x
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-push:
|
build-and-push:
|
||||||
@ -28,7 +29,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
docker buildx build . \
|
docker buildx build . \
|
||||||
-f docker/Dockerfile \
|
-f docker/Dockerfile \
|
||||||
-t vitodeploy/vito:1.x \
|
-t vitodeploy/vito:${{ github.event.release.target_commitish }} \
|
||||||
--build-arg="RELEASE=0" \
|
--build-arg="RELEASE=0" \
|
||||||
--platform linux/amd64,linux/arm64 \
|
--platform linux/amd64,linux/arm64 \
|
||||||
--no-cache \
|
--no-cache \
|
77
.github/workflows/releases.yml
vendored
Normal file
77
.github/workflows/releases.yml
vendored
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
name: manual release
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
version:
|
||||||
|
description: 'Version to release'
|
||||||
|
required: true
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
|
||||||
|
name: Release ${{ inputs.version }}
|
||||||
|
|
||||||
|
outputs:
|
||||||
|
version: ${{ steps.version.outputs.version }}
|
||||||
|
notes: ${{ steps.cleaned-notes.outputs.notes }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Remove optional "v" prefix
|
||||||
|
id: version
|
||||||
|
run: |
|
||||||
|
echo "version=${VERSION#v}" >> "$GITHUB_OUTPUT"
|
||||||
|
env:
|
||||||
|
VERSION: ${{ inputs.version }}
|
||||||
|
|
||||||
|
- name: Check if branch and version match
|
||||||
|
id: guard
|
||||||
|
run: |
|
||||||
|
MAJOR_VERSION="${NUMERIC_VERSION%%.*}"
|
||||||
|
BRANCH_MAJOR_VERSION="${BRANCH%%.*}"
|
||||||
|
|
||||||
|
if [ "$MAJOR_VERSION" != "$BRANCH_MAJOR_VERSION" ]; then
|
||||||
|
echo "Mismatched versions! Aborting."
|
||||||
|
VERSION_MISMATCH='true';
|
||||||
|
else
|
||||||
|
echo "Versions match! Proceeding."
|
||||||
|
VERSION_MISMATCH='false';
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "VERSION_MISMATCH=$(echo $VERSION_MISMATCH)" >> "$GITHUB_OUTPUT";
|
||||||
|
env:
|
||||||
|
BRANCH: ${{ github.ref_name }}
|
||||||
|
NUMERIC_VERSION: ${{ steps.version.outputs.version }}
|
||||||
|
|
||||||
|
- name: Fail if branch and release tag do not match
|
||||||
|
if: ${{ steps.guard.outputs.VERSION_MISMATCH == 'true' }}
|
||||||
|
uses: actions/github-script@v7
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
core.setFailed('Workflow failed. Release version does not match with selected target branch. Did you select the correct branch?')
|
||||||
|
|
||||||
|
- name: Update config/app.php
|
||||||
|
run: sed -i "s/'version' => '[^']*'/'version' => '${{ steps.version.outputs.version }}'/" config/app.php
|
||||||
|
|
||||||
|
- name: Commit version change
|
||||||
|
uses: stefanzweifel/git-auto-commit-action@v5
|
||||||
|
with:
|
||||||
|
commit_message: "Update version to ${{ steps.version.outputs.version }}"
|
||||||
|
|
||||||
|
- name: Create release
|
||||||
|
uses: softprops/action-gh-release@v2
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
tag_name: ${{ steps.version.outputs.version }}
|
||||||
|
name: ${{ steps.version.outputs.version }}
|
||||||
|
body: ${{ steps.cleaned-notes.outputs.notes }}
|
||||||
|
target_commitish: ${{ github.ref_name }}
|
||||||
|
make_latest: "${{ github.ref_name == github.event.repository.default_branch }}"
|
Loading…
x
Reference in New Issue
Block a user