This commit is contained in:
parent
2e878a5370
commit
03bd70e2e8
3 changed files with 45 additions and 109 deletions
|
@ -1,109 +0,0 @@
|
||||||
on:
|
|
||||||
push:
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
build:
|
|
||||||
description: "Build package and container"
|
|
||||||
required: true
|
|
||||||
default: false
|
|
||||||
type: boolean
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: container
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Get the version from git
|
|
||||||
id: version
|
|
||||||
run: echo "version=$(git describe --dirty --tags)" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Check if the package should be built
|
|
||||||
id: builder
|
|
||||||
env:
|
|
||||||
RUN: ${{ toJSON(inputs.build || !contains(steps.version.outputs.version, '-')) }}
|
|
||||||
run: |
|
|
||||||
echo "run=$RUN" >> $GITHUB_OUTPUT
|
|
||||||
echo "Run build: $RUN"
|
|
||||||
|
|
||||||
- name: Info - version and if the image container should be built
|
|
||||||
env:
|
|
||||||
VERSION: ${{ steps.version.outputs.version }}
|
|
||||||
RUN: ${{ steps.builder.outputs.run }}
|
|
||||||
FORCE: ${{ toJSON(inputs.build) }}
|
|
||||||
run: |
|
|
||||||
echo "Version $VERSION, force (manual input): $FORCE, run the build: $RUN"
|
|
||||||
|
|
||||||
- uses: pnpm/action-setup@v4
|
|
||||||
name: Install pnpm
|
|
||||||
with:
|
|
||||||
run_install: false
|
|
||||||
version: 10
|
|
||||||
|
|
||||||
- name: Install Node.js
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: 20
|
|
||||||
cache: "pnpm"
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: pnpm install
|
|
||||||
|
|
||||||
- name: Update version.json from git describe
|
|
||||||
run: pnpm run version
|
|
||||||
|
|
||||||
- name: Set the version in package.json
|
|
||||||
env:
|
|
||||||
VERSION: ${{ steps.version.outputs.version }}
|
|
||||||
run: sed "s/0.0.0/${VERSION}/" -i package.json
|
|
||||||
|
|
||||||
- name: Build package (transpile ts => js)
|
|
||||||
run: pnpm run build --base /oidc-test-web
|
|
||||||
|
|
||||||
- name: Set registry token for pnpm"
|
|
||||||
env:
|
|
||||||
LOCAL_NPM_TOKEN: ${{ secrets.LOCAL_NPM_TOKEN }}
|
|
||||||
run: pnpm set "//code.philo.ydns.eu/api/packages/philorg/npm/:_authToken=${LOCAL_NPM_TOKEN}"
|
|
||||||
|
|
||||||
- name: Publish
|
|
||||||
if: fromJSON(steps.builder.outputs.run)
|
|
||||||
run: pnpm publish --no-git-checks
|
|
||||||
continue-on-error: true
|
|
||||||
|
|
||||||
- name: Build container
|
|
||||||
if: fromJSON(steps.builder.outputs.run)
|
|
||||||
uses: actions/buildah-build@v1
|
|
||||||
with:
|
|
||||||
image: oidc-vue-test
|
|
||||||
oci: true
|
|
||||||
labels: oidc-vue-test
|
|
||||||
tags: latest ${{ steps.version.outputs.version }}
|
|
||||||
containerfiles: |
|
|
||||||
./Containerfile
|
|
||||||
build-args: |
|
|
||||||
APP_VERSION=${{ steps.version.outputs.version }}
|
|
||||||
|
|
||||||
- name: Workaround for bug of podman-login
|
|
||||||
if: fromJSON(steps.builder.outputs.run)
|
|
||||||
run: |
|
|
||||||
mkdir -p $HOME/.docker
|
|
||||||
echo "{ \"auths\": {} }" > $HOME/.docker/config.json
|
|
||||||
|
|
||||||
- name: Log in to container registry (with another workaround)
|
|
||||||
if: fromJSON(steps.builder.outputs.run)
|
|
||||||
uses: actions/podman-login@v1
|
|
||||||
with:
|
|
||||||
registry: ${{ vars.REGISTRY }}
|
|
||||||
username: ${{ secrets.REGISTRY_USER }}
|
|
||||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
|
||||||
auth_file_path: /tmp/auth.json
|
|
||||||
|
|
||||||
- name: Push the image to the registry
|
|
||||||
if: fromJSON(steps.builder.outputs.run)
|
|
||||||
uses: actions/push-to-registry@v2
|
|
||||||
with:
|
|
||||||
registry: "docker://${{ vars.REGISTRY }}/${{ vars.ORGANISATION }}"
|
|
||||||
image: oidc-vue-test
|
|
||||||
tags: latest ${{ steps.version.outputs.version }}
|
|
43
.woodpecker/build.yaml
Normal file
43
.woodpecker/build.yaml
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
when:
|
||||||
|
- event: manual
|
||||||
|
- event: tag
|
||||||
|
|
||||||
|
#depends_on:
|
||||||
|
#- test
|
||||||
|
|
||||||
|
steps:
|
||||||
|
npm:
|
||||||
|
image: code.philo.ydns.eu/philorg/pnpm
|
||||||
|
environment:
|
||||||
|
ORG: philorg
|
||||||
|
REGISTRY_TOKEN:
|
||||||
|
from_secret: registry_token
|
||||||
|
commands:
|
||||||
|
- pnpm install --frozen-lockfile
|
||||||
|
- pnpm set "//code.philo.ydns.eu/api/packages/$ORG/npm/:_authToken=$REGISTRY_TOKEN"
|
||||||
|
- pnpm publish --no-git-checks
|
||||||
|
failure: ignore
|
||||||
|
|
||||||
|
build_publish:
|
||||||
|
image: quay.io/podman/stable:latest
|
||||||
|
# Caution: This image is built daily. It might fill up your image store quickly.
|
||||||
|
#pull: true
|
||||||
|
volumes:
|
||||||
|
- containers:/var/lib/containers
|
||||||
|
- pnpm:/root/.local/share/pnpm
|
||||||
|
# Fill in the trusted checkbox in Woodpecker's settings as well
|
||||||
|
privileged: true
|
||||||
|
environment:
|
||||||
|
registry: code.philo.ydns.eu
|
||||||
|
org: philorg
|
||||||
|
container_name: oidc-vue-test
|
||||||
|
registry_token:
|
||||||
|
from_secret: registry_token
|
||||||
|
commands:
|
||||||
|
# Login at the registry
|
||||||
|
- podman login -u __token__ --password $registry_token $registry
|
||||||
|
# Build the container image
|
||||||
|
- podman build --volume=/var/lib/containers:/var/lib/containers --tag $registry/$org/$container_name:latest --tag $registry/$org/$container_name:$CI_COMMIT_TAG .
|
||||||
|
# Push the image
|
||||||
|
- podman push $registry/$org/$container_name:latest
|
||||||
|
- podman push $registry/$org/$container_name:$CI_COMMIT_TAG
|
|
@ -125,3 +125,5 @@ handle /oidc-test-web {
|
||||||
}
|
}
|
||||||
redir /oidc-test-web /oidc-test-web/
|
redir /oidc-test-web /oidc-test-web/
|
||||||
```
|
```
|
||||||
|
|
||||||
|
[](https://code.philo.ydns.eu/woodpecker/repos/18)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue