Publish #52
Workflow file for this run
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
name: Publish | |
on: | |
workflow_dispatch: {} | |
jobs: | |
docker: | |
name: Build & Publish Docker Image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Get tag | |
id: tag | |
uses: dawidd6/action-get-tag@v1 | |
with: | |
strip_v: true | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install dependencies | |
run: npm ci | |
- name: Build | |
run: npm run build:docker | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build image | |
run: docker buildx build --platform linux/amd64,linux/arm64 . -t localsandbox/localsandbox:latest --push | |
bundle-cli: | |
name: Build & Bundle CLI | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-latest | |
osname: linux | |
arch: x64 | |
- os: windows-latest | |
osname: win | |
arch: x64 | |
- os: macos-latest | |
osname: macos | |
arch: arm64 | |
- os: macos-13 | |
osname: macos | |
arch: x64 | |
runs-on: ${{ matrix.os }} | |
env: | |
BUNDLE_FILENAME: localsandbox-${{ matrix.osname }}-${{ matrix.arch }}.tar.gz | |
PKG_TARGET: ${{ matrix.osname }}-${{ matrix.arch }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up python | |
id: setup-python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: '1.23' | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install dependencies | |
run: npm ci | |
- name: Bundle CLI | |
run: npm run bundle:cli | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: localsandbox-${{ matrix.osname }}-${{ matrix.arch }}.tar.gz | |
path: ${{ env.BUNDLE_FILENAME }} | |
smoke-test-cli: | |
name: Smoke Test CLI | |
needs: bundle-cli | |
if: false | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-latest | |
osname: linux | |
arch: x64 | |
- os: windows-latest | |
osname: win | |
arch: x64 | |
- os: macos-latest | |
osname: macos | |
arch: arm64 | |
- os: macos-13 | |
osname: macos | |
arch: x64 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Homebrew | |
if: matrix.osname == 'macos' | |
id: set-up-homebrew | |
uses: Homebrew/actions/setup-homebrew@master | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: localsandbox-${{ matrix.osname }}-${{ matrix.arch }}.tar.gz | |
path: ./ | |
- name: Extract artifact | |
run: tar -xzf localsandbox-${{ matrix.osname }}-${{ matrix.arch }}.tar.gz | |
- name: Smoke test localsandbox | |
run: ./localsandbox${{ (matrix.osname == 'win' && '.exe') || '' }} --version | |
- name: Install az cli (macos) | |
if: matrix.osname == 'macos' | |
run: brew update && brew install azure-cli | |
- name: Install az cli (linux) | |
if: matrix.osname == 'linux' | |
run: curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash | |
- name: Install az cli (windows) | |
if: matrix.osname == 'win' | |
shell: powershell | |
run: $ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest -Uri https://aka.ms/installazurecliwindowsx64 -OutFile .\AzureCLI.msi; Start-Process msiexec.exe -Wait -ArgumentList '/I AzureCLI.msi /quiet'; Remove-Item .\AzureCLI.msi | |
- name: Test az cli | |
run: az --version | |
- name: Smoke test azl | |
run: ./azl${{ (matrix.osname == 'win' && '.exe') || '' }} --version | |
create-release: | |
name: Create GitHub Release | |
needs: [bundle-cli] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
path: ./ | |
- name: List files | |
run: ls -la | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
files: "**/*.tar.gz" |