chore: Test alternative buildx approach
This commit is contained in:
parent
2e6ea3f060
commit
f90cf62a71
@ -1,92 +1,105 @@
|
||||
name: Container
|
||||
on: [push]
|
||||
name: build-image
|
||||
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀 🚀 🚀
|
||||
|
||||
jobs:
|
||||
semrel_dryrun:
|
||||
name: Semantic Release (Dry-run)
|
||||
build-image:
|
||||
name: build-image
|
||||
runs-on: dind-rootless
|
||||
outputs:
|
||||
version: ${{ steps.sem_rel.outputs.version }}
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v3
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 20
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
npm install \
|
||||
semantic-release \
|
||||
@semantic-release/commit-analyzer \
|
||||
@semantic-release/exec
|
||||
- name: Semantic Release (dry-run)
|
||||
id: sem_rel
|
||||
run: |
|
||||
npx semantic-release \
|
||||
--package @semantic-release/exec \
|
||||
--package semantic-release \
|
||||
--branches ${{ gitea.refname }} \
|
||||
--tag-format 'v${version}' \
|
||||
--dry-run \
|
||||
--plugins @semantic-release/commit-analyzer,@semantic-release/exec \
|
||||
--analyzeCommits @semantic-release/commit-analyzer \
|
||||
--verifyRelease @semantic-release/exec \
|
||||
--verifyReleaseCmd 'echo "version=${nextRelease.version}" >> $GITHUB_OUTPUT'
|
||||
env:
|
||||
GIT_CREDENTIALS: ${{ secrets.GIT_USERNAME }}:${{ secrets.GIT_APIKEY }}
|
||||
- name: Assert semantic release output
|
||||
run: |
|
||||
[[ -z "${{ steps.sem_rel.outputs.version }}" ]] && {
|
||||
echo 'No release tag - exiting'; exit 1
|
||||
} || {
|
||||
echo 'Release tag set correctly: ${{ steps.sem_rel.outputs.version }}'; exit 0
|
||||
}
|
||||
|
||||
build_container:
|
||||
name: Container image
|
||||
container: catthehacker/ubuntu:act-latest
|
||||
runs-on: dind
|
||||
needs: semrel_dryrun
|
||||
container:
|
||||
image: ghcr.io/catthehacker/ubuntu:act-latest
|
||||
# image: gitea/runner-images:ubuntu-latest
|
||||
image: gitea.example.com/xyz/ubuntu-act:22.04
|
||||
# credentials:
|
||||
# username: ${{ gitea.actor }}
|
||||
# password: ${{ secrets.GA_TOKEN }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Kaniko build
|
||||
uses: aevea/action-kaniko@master
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install QEMU
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y qemu-user-static
|
||||
#
|
||||
# https://github.com/docker/metadata-action
|
||||
#
|
||||
# - name: Docker meta
|
||||
# id: meta
|
||||
# uses: docker/metadata-action@v5
|
||||
# with:
|
||||
# images: |
|
||||
# gitea.example.com/xyz/alpine
|
||||
# tags: |
|
||||
# type=schedule,pattern={{date 'YYYYMMDDHHMM'}}
|
||||
# type=semver,pattern={{version}}
|
||||
# type=semver,pattern={{major}}.{{minor}}
|
||||
# type=semver,pattern={{major}}
|
||||
# type=sha
|
||||
- name: Set up Docker Context for Buildx
|
||||
id: buildx-context
|
||||
run: |
|
||||
export DOCKER_HOST=tcp://docker:2376/
|
||||
export DOCKER_TLS_CERTDIR="/certs"
|
||||
export DOCKER_TLS_VERIFY=1
|
||||
export DOCKER_CERT_PATH="/certs/client"
|
||||
docker context create builders
|
||||
# https://github.com/docker/setup-buildx-action
|
||||
# https://docs.docker.com/engine/reference/commandline/cli/#environment-variables
|
||||
- name: Setup Docker Buildx
|
||||
id: buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
# buildkitd-flags: --debug
|
||||
endpoint: builders
|
||||
env:
|
||||
DOCKER_HOST: "tcp://docker:2376/"
|
||||
DOCKER_TLS_CERTDIR: "/certs"
|
||||
DOCKER_TLS_VERIFY: 1
|
||||
DOCKER_CERT_PATH: "/certs/client"
|
||||
|
||||
#
|
||||
# Debug
|
||||
#
|
||||
- name: Available platforms
|
||||
run: echo ${{ steps.buildx.outputs.platforms }}
|
||||
|
||||
#
|
||||
# https://github.com/docker/login-action
|
||||
#
|
||||
- name: Login to Gitea
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
extra_args: |
|
||||
--build-arg REPO_USERNAME=${{ secrets.REPO_USERNAME }} \
|
||||
--build-arg REPO_PASSWORD=${{ secrets.REPO_PASSWORD }}
|
||||
registry: code.spamasaurus.com
|
||||
image: djpbessems/packer-extended
|
||||
username: ${{ secrets.GIT_USERNAME }}
|
||||
username: ${{ gitea.actor }}
|
||||
password: ${{ secrets.GIT_APIKEY }}
|
||||
tag: ${{ needs.semrel_dryrun.outputs.version }}
|
||||
|
||||
semrel:
|
||||
name: Semantic Release
|
||||
runs-on: dind-rootless
|
||||
needs: build_container
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v3
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v3
|
||||
#
|
||||
# https://github.com/docker/build-push-action
|
||||
#
|
||||
- name: Build and push the image
|
||||
if: gitea.event_name != 'pull_request'
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
node-version: 20
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
npm install \
|
||||
semantic-release \
|
||||
@semantic-release/changelog \
|
||||
@semantic-release/commit-analyzer \
|
||||
@semantic-release/git \
|
||||
@semantic-release/release-notes-generator
|
||||
- name: Semantic Release
|
||||
run: |
|
||||
npx semantic-release \
|
||||
--branches ${{ gitea.refname }} \
|
||||
--tag-format 'v${version}' \
|
||||
--plugins @semantic-release/commit-analyzer,@semantic-release/release-notes-generator,@semantic-release/changelog,@semantic-release/git
|
||||
push: ${{ gitea.event_name != 'pull_request' }}
|
||||
platforms: linux/amd64
|
||||
context: containers/test
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
env:
|
||||
GIT_CREDENTIALS: ${{ secrets.GIT_USERNAME }}:${{ secrets.GIT_APIKEY }}
|
||||
DOCKER_HOST: "tcp://docker:2376/"
|
||||
DOCKER_TLS_CERTDIR: "/certs"
|
||||
DOCKER_TLS_VERIFY: 1
|
||||
DOCKER_CERT_PATH: "/certs/client"
|
||||
|
||||
#
|
||||
#
|
||||
#
|
||||
- name: Inspect
|
||||
run: |
|
||||
docker buildx imagetools inspect gitea.example.com/xyz/ubuntu-act:22.04
|
||||
env:
|
||||
DOCKER_HOST: "tcp://docker:2376/"
|
||||
DOCKER_TLS_CERTDIR: "/certs"
|
||||
DOCKER_TLS_VERIFY: 1
|
||||
DOCKER_CERT_PATH: "/certs/client"
|
||||
|
92
.gitea/workflows/actions.yaml.disabled
Normal file
92
.gitea/workflows/actions.yaml.disabled
Normal file
@ -0,0 +1,92 @@
|
||||
name: Container
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
semrel_dryrun:
|
||||
name: Semantic Release (Dry-run)
|
||||
runs-on: dind-rootless
|
||||
outputs:
|
||||
version: ${{ steps.sem_rel.outputs.version }}
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v3
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 20
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
npm install \
|
||||
semantic-release \
|
||||
@semantic-release/commit-analyzer \
|
||||
@semantic-release/exec
|
||||
- name: Semantic Release (dry-run)
|
||||
id: sem_rel
|
||||
run: |
|
||||
npx semantic-release \
|
||||
--package @semantic-release/exec \
|
||||
--package semantic-release \
|
||||
--branches ${{ gitea.refname }} \
|
||||
--tag-format 'v${version}' \
|
||||
--dry-run \
|
||||
--plugins @semantic-release/commit-analyzer,@semantic-release/exec \
|
||||
--analyzeCommits @semantic-release/commit-analyzer \
|
||||
--verifyRelease @semantic-release/exec \
|
||||
--verifyReleaseCmd 'echo "version=${nextRelease.version}" >> $GITHUB_OUTPUT'
|
||||
env:
|
||||
GIT_CREDENTIALS: ${{ secrets.GIT_USERNAME }}:${{ secrets.GIT_APIKEY }}
|
||||
- name: Assert semantic release output
|
||||
run: |
|
||||
[[ -z "${{ steps.sem_rel.outputs.version }}" ]] && {
|
||||
echo 'No release tag - exiting'; exit 1
|
||||
} || {
|
||||
echo 'Release tag set correctly: ${{ steps.sem_rel.outputs.version }}'; exit 0
|
||||
}
|
||||
|
||||
build_container:
|
||||
name: Container image
|
||||
# container: catthehacker/ubuntu:act-latest
|
||||
# runs-on: dind
|
||||
# needs: semrel_dryrun
|
||||
# steps:
|
||||
# - name: Checkout
|
||||
# uses: actions/checkout@v4
|
||||
# - name: Kaniko build
|
||||
# uses: aevea/action-kaniko@master
|
||||
# with:
|
||||
# extra_args: |
|
||||
# --build-arg REPO_USERNAME=${{ secrets.REPO_USERNAME }} \
|
||||
# --build-arg REPO_PASSWORD=${{ secrets.REPO_PASSWORD }}
|
||||
# registry: code.spamasaurus.com
|
||||
# image: djpbessems/packer-extended
|
||||
# username: ${{ secrets.GIT_USERNAME }}
|
||||
# password: ${{ secrets.GIT_APIKEY }}
|
||||
# tag: ${{ needs.semrel_dryrun.outputs.version }}
|
||||
|
||||
semrel:
|
||||
name: Semantic Release
|
||||
runs-on: dind-rootless
|
||||
needs: build_container
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v3
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 20
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
npm install \
|
||||
semantic-release \
|
||||
@semantic-release/changelog \
|
||||
@semantic-release/commit-analyzer \
|
||||
@semantic-release/git \
|
||||
@semantic-release/release-notes-generator
|
||||
- name: Semantic Release
|
||||
run: |
|
||||
npx semantic-release \
|
||||
--branches ${{ gitea.refname }} \
|
||||
--tag-format 'v${version}' \
|
||||
--plugins @semantic-release/commit-analyzer,@semantic-release/release-notes-generator,@semantic-release/changelog,@semantic-release/git
|
||||
env:
|
||||
GIT_CREDENTIALS: ${{ secrets.GIT_USERNAME }}:${{ secrets.GIT_APIKEY }}
|
Loading…
Reference in New Issue
Block a user