ws-office/.forgejo/workflows/push/web.yaml

73 lines
2.4 KiB
YAML

on:
push:
branches:
- main
jobs:
create-package:
runs-on: self-hosted
container:
image: catthehacker/ubuntu:act-latest
# options: "-v "
steps:
- name: Check out Repo
uses: https://code.forgejo.org/actions/checkout@v3
- name: Set up Docker BuildX
uses: docker/setup-buildx-action@v2
- name: Connect to git2.workstreams.ch Docker registry
uses: https://github.com/docker/login-action@v2
with:
registry: git2.workstreams.ch
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set RELEASE_TAG
run: |
release_timestamp="$(date +%s)"
release_short_sha="$(git rev-parse --short HEAD)"
release_tag="$release_timestamp-$release_short_sha"
echo "RELEASE_TAG=$release_tag" >> $GITHUB_ENV
echo "The release tag will be '${release_tag}'"
- name: Package URL
run: |
package_url="git2.workstreams.ch/workstreams-os/ws-office-dev:${{ env.RELEASE_TAG }}"
echo "PACKAGE_URL=$package_url" >> $GITHUB_ENV
echo "PACKAGE URL: $package_url"
- name: Set PRODUCT_VERSION and BUILD_NUMBER
run: |
export $(grep -v '^#' .env | xargs)
echo "PRODUCT_VERSION=$product_version" >> $GITHUB_ENV
echo "BUILD_NUMBER=$build_number" >> $GITHUB_ENV
echo "PRODUCT_VERSION: '${product_version}'"
echo "BUILD_NUMBER: '${build_number}'"
- name: Docker Build
uses: https://github.com/docker/build-push-action@v4
env:
ACTIONS_RUNTIME_TOKEN: "" # See https://gitea.com/gitea/act_runner/issues/119
with:
context: ./
build-args: |
product_version=${{ env.PRODUCT_VERSION }}
build_number=${{ env.BUILD_NUMBER }}
file: ./Dockerfile
platforms: |
linux/amd64
push: true
tags: |
${{ env.PACKAGE_URL }}
# cache-from: type=local,src=/tmp/.buildx-cache
# cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
# - # Temp fix
# # https://github.com/docker/build-push-action/issues/252
# # https://github.com/moby/buildkit/issues/1896
# name: Move cache
# run: |
# rm -rf /tmp/.buildx-cache
# mv /tmp/.buildx-cache-new /tmp/.buildx-cache