Fix setting environment vars in GitHub workflow. (#80) #241
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: wkdev-sdk | |
on: | |
push: | |
branches: [ main, tag/** ] | |
paths-ignore: [ docs/*, README.md] | |
pull_request: | |
paths-ignore: [ docs/*, README.md] | |
create: | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build: | |
runs-on: self-hosted | |
steps: | |
- name: Set tag name | |
run: | | |
if [ "${GITHUB_BASE_REF}" = 'main' ]; then | |
echo "WKDEV_SDK_TAG=latest" >> "${GITHUB_ENV}" | |
fi | |
echo "WKDEV_SDK_CONTAINER_REGISTRY_USER_NAME=$(echo ${GITHUB_REPOSITORY_OWNER} | tr '[:upper:]' '[:lower:]')" >> "${GITHUB_ENV}" | |
- name: Install podman | |
run: sudo apt-get update && sudo apt-get -y install podman fuse-overlayfs | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Prune podman containers/images | |
run: | | |
podman system prune --all --force | |
- name: Build image | |
run: | | |
source ./register-sdk-on-host.sh | |
wkdev-sdk-bakery --mode=build --verbose | |
wkdev-sdk-bakery --mode=export --verbose | |
- name: Archive image | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wkdev-sdk.tar | |
path: wkdev-sdk.tar | |
retention-days: 7 | |
- name: Test image | |
run: | | |
CONTAINER="wkdev-$(date +%s)" | |
source ./register-sdk-on-host.sh | |
wkdev-create --create-home --home ${HOME}/${CONTAINER}-home --verbose --attach --no-pull --name ${CONTAINER} | |
wkdev-enter -n ${CONTAINER} --exec -- git clone --depth=1 https://github.com/WebKit/WebKit.git | |
wkdev-enter -n ${CONTAINER} --exec -- ./WebKit/Tools/Scripts/build-webkit --wpe --release --generate-project-only | |
wkdev-enter -n ${CONTAINER} --exec -- ./WebKit/Tools/Scripts/build-webkit --gtk --release --generate-project-only | |
podman stop ${CONTAINER} || true | |
podman rm ${CONTAINER} || true | |
rm -rf ${HOME}/${CONTAINER}-home | |
deploy: | |
runs-on: self-hosted | |
needs: build | |
if: github.ref_name == 'main' || startsWith(github.ref_name, 'tag/') | |
steps: | |
- name: Set tag name | |
run: | | |
if [ "${GITHUB_BASE_REF}" = 'main' ]; then | |
echo "WKDEV_SDK_TAG=latest" >> "${GITHUB_ENV}" | |
fi | |
echo "WKDEV_SDK_CONTAINER_REGISTRY_USER_NAME=$(echo ${GITHUB_REPOSITORY_OWNER} | tr '[:upper:]' '[:lower:]')" >> "${GITHUB_ENV}" | |
- name: Install podman | |
run: sudo apt-get update && sudo apt-get -y install podman fuse-overlayfs | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Download image | |
uses: actions/download-artifact@v4 | |
with: | |
name: wkdev-sdk.tar | |
- name: Deploy image | |
run: | | |
podman load < wkdev-sdk.tar | |
echo "${{ secrets.GITHUB_TOKEN }}" | podman login ghcr.io --username=${GITHUB_REPOSITORY_OWNER} --password-stdin | |
source ./register-sdk-on-host.sh | |
wkdev-sdk-bakery --mode=deploy --verbose |