mirror of
https://github.com/flameshikari/outline-ru.git
synced 2026-06-13 04:05:10 +03:00
161 lines
4.8 KiB
YAML
161 lines
4.8 KiB
YAML
name: Build
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
- dev
|
|
paths:
|
|
- .github/workflows/**
|
|
- outline/**
|
|
- translation/ru.json
|
|
- Dockerfile
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: outline
|
|
|
|
env:
|
|
DOCKER_BUILD_CHECKS_ANNOTATIONS: false
|
|
DOCKER_BUILD_SUMMARY: false
|
|
DOCKER_BUILD_RECORD_UPLOAD: false
|
|
|
|
jobs:
|
|
build:
|
|
name: Build [${{ matrix.arch }}]
|
|
runs-on: ${{ contains(matrix.arch, 'arm') && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }}
|
|
outputs:
|
|
version: ${{ steps.version.outputs.version }}
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
strategy:
|
|
matrix:
|
|
arch:
|
|
- amd64
|
|
- arm64
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v6
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: Setup Docker Buildx
|
|
uses: docker/setup-buildx-action@v4
|
|
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v4
|
|
with:
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
- name: Login to GitHub CR
|
|
uses: docker/login-action@v4
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Set Version
|
|
id: version
|
|
run: |
|
|
version=$(jq -r '.version' outline/package.json)
|
|
[[ -z $version ]] && exit 1
|
|
echo "version=$version" | tee -a $GITHUB_OUTPUT
|
|
|
|
- name: Set Metadata
|
|
uses: docker/metadata-action@v6
|
|
id: metadata
|
|
with:
|
|
images: |
|
|
${{ github.repository }}
|
|
ghcr.io/${{ github.repository }}
|
|
|
|
- name: Build Image
|
|
uses: docker/build-push-action@v7
|
|
id: build
|
|
with:
|
|
cache-from: type=gha,scope=build-${{ matrix.arch }}
|
|
cache-to: type=gha,mode=max,scope=build-${{ matrix.arch }}
|
|
platforms: linux/${{ matrix.arch }}
|
|
build-args: |
|
|
APP_PATH=/opt/outline
|
|
SRC_PATH=./outline
|
|
labels: ${{ steps.metadata.outputs.labels }}
|
|
outputs: type=image,"name=${{ github.repository }},ghcr.io/${{ github.repository }}",push-by-digest=true,name-canonical=true,push=true
|
|
|
|
- name: Export Digests
|
|
run: |
|
|
mkdir -p ${{ runner.temp }}/digests
|
|
digest="${{ steps.build.outputs.digest }}"
|
|
touch "${{ runner.temp }}/digests/${digest#sha256:}"
|
|
|
|
- name: Upload Digests
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: digests-linux-${{ matrix.arch }}
|
|
path: ${{ runner.temp }}/digests/*
|
|
if-no-files-found: error
|
|
retention-days: 1
|
|
|
|
publish:
|
|
name: Publish
|
|
runs-on: ubuntu-24.04
|
|
needs: build
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
env:
|
|
version: ${{ needs.build.outputs.version }}
|
|
steps:
|
|
- name: Download Digests
|
|
uses: actions/download-artifact@v8
|
|
with:
|
|
path: ${{ runner.temp }}/digests
|
|
pattern: digests-*
|
|
merge-multiple: true
|
|
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v4
|
|
with:
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
- name: Login to GitHub CR
|
|
uses: docker/login-action@v4
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Setup Docker Buildx
|
|
uses: docker/setup-buildx-action@v4
|
|
|
|
- name: Set Metadata
|
|
uses: docker/metadata-action@v6
|
|
with:
|
|
images: |
|
|
${{ github.repository }}
|
|
ghcr.io/${{ github.repository }}
|
|
tags: |
|
|
type=raw,value=nightly,enable=${{ github.ref == 'refs/heads/dev' }}
|
|
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/master' }}
|
|
type=raw,value=${{ env.version }},enable=${{ github.ref == 'refs/heads/master' }}
|
|
|
|
- name: Create Manifest & Push
|
|
working-directory: ${{ runner.temp }}/digests
|
|
run: |
|
|
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
|
|
$(printf '${{ github.repository }}@sha256:%s ' *)
|
|
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
|
|
$(printf 'ghcr.io/${{ github.repository }}@sha256:%s ' *)
|
|
|
|
- name: Create Release
|
|
uses: softprops/action-gh-release@v3
|
|
if: ${{ github.ref == 'refs/heads/master' }}
|
|
with:
|
|
name: ${{ env.version }}
|
|
tag_name: ${{ env.version }}
|
|
body: "[Изменения в ${{ env.version }}](https://github.com/outline/outline/releases/tag/v${{ env.version }})"
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|