shiori/.github/workflows/_buildx.yml
Felipe Martin 647945c54e
ci: unify local and ci docker workflows (#907)
* deps: go to 1.22.3

* removed ci dockerfile

* add make buildx

* updated dockerfile

* ci uses make buildx command

* commented upx for the future

* disable openbsd/arm tests

* wip

* put dist file in dist path

* removed unused make command

* build-local to speed up local tests

* don't clean when buildx

* podman workaround

* manually define source files for tests
2024-05-14 08:01:52 +02:00

53 lines
1.8 KiB
YAML

name: "Build Docker"
on: workflow_call
jobs:
buildx:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
name: Build Docker
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
with:
fetch-depth: 0
- uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # 4.1.7
with:
name: dist
path: ./dist
# Every pull request that goes into master
- name: Prepare master push tags
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: |
REPO=ghcr.io/${{ github.repository }}
TAG=$(git describe --tags)
echo "tag_flags=--tag $REPO:$TAG" >> $GITHUB_ENV
# New tagged version
- name: Prepare version push tags
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
run: |
REPO=ghcr.io/${{ github.repository }}
TAG=$(git describe --tags)
if [[ "$TAG" == *"rc"* ]]
then
TAG2="dev"
else
TAG2="latest"
fi
echo "tag_flags=--tag $REPO:$TAG --tag $REPO:$TAG2" >> $GITHUB_ENV
# Every pull request
- name: Prepare pull request tags
if: github.event_name == 'pull_request'
run: |
echo "tag_flags=--tag ${{ github.ref }}" >> $GITHUB_ENV
REPO=ghcr.io/${{ github.repository }}
echo "tag_flags=--tag $REPO:pr-${{ github.event.pull_request.number }}" >> $GITHUB_ENV
- name: Buildx
run: |
set -x
echo "${{ secrets.GITHUB_TOKEN }}" | docker login -u "${{ github.repository_owner }}" --password-stdin ghcr.io
make buildx CONTAINER_BUILDX_OPTIONS="--push ${{ env.tag_flags }}"