Skip to content

Deploy project

Deploy project #361

Workflow file for this run

name: Deploy project
on:
push:
branches: [ main ]
schedule:
- cron: '30 3 * * 1' # At 03:30 on Monday, every Monday.
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
permissions:
contents: read
env:
MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryhandler.count=5 -Dmaven.wagon.httpconnectionManager.ttlSeconds=240
jobs:
stage-snapshot:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- setup: centos6-x86_64
docker-compose-build: "-f docker/docker-compose.centos-6.yaml -f docker/docker-compose.centos-6.18.yaml build"
docker-compose-run: "-f docker/docker-compose.centos-6.yaml -f docker/docker-compose.centos-6.18.yaml run stage-snapshot"
- setup: debian7-x86_64
docker-compose-build: "-f docker/docker-compose.debian.yaml -f docker/docker-compose.debian-7.18.yaml build"
docker-compose-run: "-f docker/docker-compose.debian.yaml -f docker/docker-compose.debian-7.18.yaml run stage-snapshot"
- setup: centos7-aarch64
docker-compose-build: "-f docker/docker-compose.centos-7.yaml build"
docker-compose-run: "-f docker/docker-compose.centos-7.yaml run cross-compile-aarch64-stage-snapshot"
name: stage-snapshot-${{ matrix.setup }}
steps:
- uses: actions/checkout@v3
# Cache .m2/repository
- uses: actions/cache@v3
with:
path: ~/.m2/repository
key: stage-snapshot-${{ matrix.setup }}-m2-repository-cache-${{ hashFiles('**/pom.xml') }}
restore-keys: |
stage-snapshot-${{ matrix.setup }}-m2-repository-cache-
# Enable caching of Docker layers
- uses: satackey/[email protected]
env:
docker-cache-name: staging-${{ matrix.setup }}-cache-docker
continue-on-error: true
with:
key: ${{ runner.os }}-staging-${{ env.docker-cache-name }}-{hash}
restore-keys: |
${{ runner.os }}-staging-${{ env.docker-cache-name }}-
- name: Create local staging directory
run: mkdir -p ~/local-staging
- name: Build docker image
run: docker-compose ${{ matrix.docker-compose-build }}
- name: Stage snapshots to local staging directory
run: docker-compose ${{ matrix.docker-compose-run }}
- name: Upload local staging directory
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.setup }}-local-staging
path: ~/local-staging
if-no-files-found: error
stage-snapshot-windows:
runs-on: windows-2019
name: stage-snapshot-windows-x86_64
steps:
- uses: actions/checkout@v3
- name: Create local staging directory
run: mkdir local-staging
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: 8
distribution: zulu
- name: Add msbuild to PATH
uses: microsoft/[email protected]
- name: Configuring Developer Command Prompt
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x86_amd64
- name: Install tools
uses: crazy-max/ghaction-chocolatey@v1
with:
args: install ninja nasm
# Cache .m2/repository
- uses: actions/cache@v3
with:
path: ~/.m2/repository
key: stage-snapshot-windows-m2-repository-cache-${{ hashFiles('**/pom.xml') }}
restore-keys: |
stage-snapshot-windows-m2-repository-cache-
- name: Build netty-tcnative-boringssl-static
run: ./mvnw.cmd --file pom.xml -am -pl boringssl-static clean package org.sonatype.plugins:nexus-staging-maven-plugin:deploy -DaltStagingDirectory=local-staging -DskipRemoteStaging=true -DskipTests=true
- name: Upload local staging directory
uses: actions/upload-artifact@v3
with:
name: windows-x86_64-local-staging
path: boringssl-static/local-staging
if-no-files-found: error
deploy-staged-snapshots:
runs-on: ubuntu-latest
# Wait until we have staged everything
needs: [stage-snapshot, stage-snapshot-windows]
steps:
- uses: actions/checkout@v3
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: 8
distribution: zulu
# Setup some env to re-use later.
- name: Prepare enviroment variables
run: |
echo "LOCAL_STAGING_DIR=$HOME/local-staging" >> $GITHUB_ENV
# Hardcode the staging artifacts that need to be downloaded.
# These must match the matrix setups and windows build. There is currently no way to pull this out of the config.
- name: Download windows_x86_64 staging directory
uses: actions/download-artifact@v3
with:
name: windows-x86_64-local-staging
path: ~/windows-x86_64-local-staging
- name: Download centos7-aarch64 staging directory
uses: actions/download-artifact@v3
with:
name: centos7-aarch64-local-staging
path: ~/centos7-aarch64-local-staging
- name: Download debian7-x86_64 staging directory
uses: actions/download-artifact@v3
with:
name: debian7-x86_64-local-staging
path: ~/debian7-x86_64-local-staging
- name: Download centos6-x86_64 staging directory
uses: actions/download-artifact@v3
with:
name: centos6-x86_64-local-staging
path: ~/centos6-x86_64-local-staging
- name: Merge staging repositories
run: |
mkdir -p ~/local-staging/deferred
cat ~/windows-x86_64-local-staging/deferred/.index >> ~/local-staging/deferred/.index
cp -r ~/windows-x86_64-local-staging/deferred/* ~/local-staging/deferred/
cat ~/centos7-aarch64-local-staging/deferred/.index >> ~/local-staging/deferred/.index
cp -r ~/centos7-aarch64-local-staging/deferred/* ~/local-staging/deferred/
cat ~/debian7-x86_64-local-staging/deferred/.index >> ~/local-staging/deferred/.index
cp -r ~/debian7-x86_64-local-staging/deferred/* ~/local-staging/deferred/
cat ~/centos6-x86_64-local-staging/deferred/.index >> ~/local-staging/deferred/.index
cp -r ~/centos6-x86_64-local-staging/deferred/* ~/local-staging/deferred/
# Cache .m2/repository
- uses: actions/cache@v3
with:
path: ~/.m2/repository
key: deploy-staged-snapshot-m2-repository-cache-${{ hashFiles('**/pom.xml') }}
restore-keys: |
deploy-stage-snapshot-m2-repository-cache-
- uses: s4u/[email protected]
with:
servers: |
[{
"id": "sonatype-nexus-snapshots",
"username": "${{ secrets.SONATYPE_USERNAME }}",
"password": "${{ secrets.SONATYPE_PASSWORD }}"
}]
- name: Deploy local staged artifacts
run: ./mvnw -B --file pom.xml org.sonatype.plugins:nexus-staging-maven-plugin:deploy-staged -DaltStagingDirectory=$LOCAL_STAGING_DIR