Core for Stable Release Version #77
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
on: | |
schedule: | |
- cron: '0 1 * * *' | |
name: Core for Stable Release Version | |
jobs: | |
core-build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
component: [core] | |
steps: | |
- name: Free Disk Space (Ubuntu) | |
uses: jlumbroso/free-disk-space@main | |
with: | |
tool-cache: true | |
android: true | |
dotnet: true | |
haskell: true | |
large-packages: true | |
docker-images: true | |
swap-storage: true | |
- uses: actions/checkout@v4 | |
- uses: docker/setup-qemu-action@v3 | |
- uses: docker/setup-buildx-action@v3 | |
- uses: actions/setup-python@v4 | |
if: matrix.component == 'core' | |
with: | |
python-version: 3.11 | |
- uses: abatilo/actions-poetry@v2 | |
if: matrix.component == 'core' | |
- name: Get Version | |
run: | | |
echo "version=$(curl -s https://github.com/gitapi/repos/jumpserver/jumpserver/releases/latest | jq -r .tag_name)" >> $GITHUB_ENV | |
- name: Generate poetry.lock | |
if: matrix.component == 'core' | |
run: | | |
wget --quiet https://github.com/jumpserver/jumpserver/raw/dev/pyproject.toml | |
sed -i 's@^cython =@# cython =@g' pyproject.toml | |
sed -i 's@^certifi =@# certifi =@g' pyproject.toml | |
sed -i 's@^cffi =@# cffi =@g' pyproject.toml | |
sed -i 's@^idna =@# idna =@g' pyproject.toml | |
sed -i 's@^urllib3 =@# urllib3 =@g' pyproject.toml | |
sed -i 's@^cryptography =@# cryptography =@g' pyproject.toml | |
sed -i 's@^COPY --from=stage-1 /opt/jumpserver/poetry.lock /opt/jumpserver/pyproject.toml@ADD poetry.lock pyproject.toml@g' core/Dockerfile | |
poetry config virtualenvs.create false | |
poetry source remove tsinghua | |
poetry source add --priority=primary PyPI | |
poetry lock --no-update | |
- name: Cache | |
uses: actions/cache@v3 | |
id: cache | |
with: | |
path: | | |
var-cache-apt | |
var-lib-apt | |
pypi-cache | |
key: cache-${{ matrix.component }} | |
- name: inject cache into docker | |
uses: reproducible-containers/buildkit-cache-dance@v3.1.0 | |
with: | |
cache-map: | | |
{ | |
"var-cache-apt": "/var/cache/apt", | |
"var-lib-apt": "/var/lib/apt", | |
"pypi-cache": "/root/.cache" | |
} | |
skip-extraction: ${{ steps.cache.outputs.cache-hit }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and Push Image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
provenance: false | |
file: ${{ matrix.component }}/Dockerfile | |
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/s390x | |
push: true | |
tags: | | |
ghcr.io/${{ github.repository_owner }}/jms_${{ matrix.component }}:buildcache | |
outputs: type=image,oci-mediatypes=true,compression=zstd,compression-level=3,force-compression=true | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |