feat(config): expand env in config #45
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: | |
push: | |
branches: | |
- master | |
tags: | |
- 'v*' | |
pull_request: | |
branches: | |
- master | |
permissions: | |
packages: write | |
contents: write | |
jobs: | |
php-lint: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.2' | |
- name: Cache Composer dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ~/.composer/cache | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-composer- | |
- name: Install Composer dependencies | |
run: composer install --no-scripts --no-progress --no-suggest --no-interaction | |
- name: Run phpcs | |
run: composer phpcs | |
- name: Run phpstan | |
run: composer phpstan | |
go-lint: | |
runs-on: ubuntu-latest | |
container: | |
image: golangci/golangci-lint:v1.59.1-alpine | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Run Go linters | |
run: golangci-lint run ./... | |
build: | |
runs-on: ubuntu-latest | |
needs: [php-lint, go-lint] | |
if: startsWith(github.ref, 'refs/tags/') | |
strategy: | |
matrix: | |
platform: [amd64, arm64] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Compile binary | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
TAG: ${{ github.ref_name }} | |
run: | | |
docker run --rm \ | |
-e RT_TOKEN="$GITHUB_TOKEN" \ | |
-e VERSION=v2024.1.3-thumper-"$TAG" \ | |
-e TIME="$(date +%FT%T%z)" \ | |
-e CGO_ENABLED=0 \ | |
-e GOOS=linux \ | |
-e GOARCH=${{ matrix.platform }} \ | |
-v $(pwd):/plugin \ | |
-w /plugin \ | |
ghcr.io/roadrunner-server/velox:2024.1.3 \ | |
build -c velox_rr.toml -o /plugin | |
- name: Rename release asset | |
run: mv ./rr ./rr-${{ matrix.platform }} | |
- name: Upload release asset | |
uses: actions/upload-artifact@v4 | |
with: | |
name: rr-binary-${{ matrix.platform }} | |
path: ./rr-${{ matrix.platform }} | |
docker: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Download Binary (amd64) | |
uses: actions/download-artifact@v4 | |
with: | |
name: rr-binary-amd64 | |
path: ./ | |
- name: Download Binary (arm64) | |
uses: actions/download-artifact@v4 | |
with: | |
name: rr-binary-arm64 | |
path: ./ | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: linux/amd64,linux/arm64 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: Dockerfile | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
tags: ghcr.io/${{ github.repository }}:${{ github.ref_name }} | |
release: | |
needs: docker | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download Binary (amd64) | |
uses: actions/download-artifact@v4 | |
with: | |
name: rr-binary-amd64 | |
path: ./artifact | |
- name: Download Binary (arm64) | |
uses: actions/download-artifact@v4 | |
with: | |
name: rr-binary-arm64 | |
path: ./artifact | |
- name: Create Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: | | |
./artifact/rr-amd64 | |
./artifact/rr-arm64 | |
body: 'Docker image available at [ghcr.io/${{ github.repository }}](https://ghcr.io/${{ github.repository }})' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |