shorten the labels #1207
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: ci | |
on: push | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 16.x | |
- name: install shellspec | |
run: curl -sfSL https://git.io/shellspec | sh -s 0.28.1 --yes | |
- run: which shellspec | |
- run: npm install | |
- run: npm run standard | |
- run: npm run test | |
- run: npm run testshell | |
- run: npm audit --omit=dev | |
# test-windows: | |
# runs-on: windows-latest | |
# strategy: | |
# fail-fast: true | |
# steps: | |
# - uses: actions/checkout@v4 | |
# - uses: actions/setup-node@v4 | |
# with: | |
# node-version: 16.x | |
# - run: npm install | |
# - run: npm run standard | |
# - run: npm test | |
# run only on semantic version tag | |
release: | |
needs: test | |
if: startsWith(github.ref, 'refs/tags/v') && contains(github.ref, '.') | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
# GITHUB_ENV operates like a .env file | |
- name: extract version | |
run: | | |
VERSION=${GITHUB_REF#refs/tags/} | |
CLEAN_VERSION=${VERSION#v} | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
echo "CLEAN_VERSION=$CLEAN_VERSION" >> $GITHUB_ENV | |
- name: node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 16.x | |
# https://news.ycombinator.com/item?id=32388964 | |
# https://github.com/procursusteam/ldid | |
# https://www.pulumi.com/blog/nodejs-binaries-with-pkg/ | |
# https://github.com/pulumi/pulumi-aws-static-website/blob/main/.github/workflows/release.yaml | |
- name: ldid for macos binary building | |
uses: MOZGIII/install-ldid-action@v1 | |
with: | |
tag: v2.1.5-procursus2 | |
- name: npm install | |
run: npm install | |
- name: pkg | |
run: | | |
echo "pkg-ing" | |
./node_modules/.bin/pkg . --no-bytecode --public-packages "*" --public --target node16-macos-x64 --output bin/darwin-amd64/dotenvx | |
./node_modules/.bin/pkg . --no-bytecode --public-packages "*" --public --target node16-macos-x64 --output bin/darwin-x86_64/dotenvx | |
./node_modules/.bin/pkg . --no-bytecode --public-packages "*" --public --target node16-macos-arm64 --output bin/darwin-arm64/dotenvx | |
./node_modules/.bin/pkg . --no-bytecode --public-packages "*" --public --target node16-linuxstatic-x64 --output bin/linux-amd64/dotenvx | |
./node_modules/.bin/pkg . --no-bytecode --public-packages "*" --public --target node16-linuxstatic-x64 --output bin/linux-x86_64/dotenvx | |
./node_modules/.bin/pkg . --no-bytecode --public-packages "*" --public --target node16-linuxstatic-arm64 --output bin/linux-arm64/dotenvx | |
./node_modules/.bin/pkg . --no-bytecode --public-packages "*" --public --target node16-linuxstatic-arm64 --output bin/linux-aarch64/dotenvx | |
./node_modules/.bin/pkg . --no-bytecode --public-packages "*" --public --target node16-win-x64 --output bin/windows-amd64/dotenvx.exe | |
./node_modules/.bin/pkg . --no-bytecode --public-packages "*" --public --target node16-win-x64 --output bin/windows-x86_64/dotenvx.exe | |
echo "change ownership" | |
sudo chown -R root:root bin/ | |
echo "dist-ing" | |
mkdir -p dist | |
mkdir -p dist2 | |
mkdir -p dist2/${{ env.VERSION }} | |
mkdir -p dist2/latest | |
tar --gzip -cf ./dist/dotenvx-${{ env.CLEAN_VERSION }}-darwin-amd64.tar.gz -C bin/darwin-amd64/ . | |
tar --gzip -cf ./dist/dotenvx-${{ env.CLEAN_VERSION }}-darwin-x86_64.tar.gz -C bin/darwin-x86_64/ . | |
tar --gzip -cf ./dist/dotenvx-${{ env.CLEAN_VERSION }}-darwin-arm64.tar.gz -C bin/darwin-arm64/ . | |
tar --gzip -cf ./dist/dotenvx-${{ env.CLEAN_VERSION }}-linux-amd64.tar.gz -C bin/linux-amd64/ . | |
tar --gzip -cf ./dist/dotenvx-${{ env.CLEAN_VERSION }}-linux-x86_64.tar.gz -C bin/linux-x86_64/ . | |
tar --gzip -cf ./dist/dotenvx-${{ env.CLEAN_VERSION }}-linux-arm64.tar.gz -C bin/linux-arm64/ . | |
tar --gzip -cf ./dist/dotenvx-${{ env.CLEAN_VERSION }}-linux-aarch64.tar.gz -C bin/linux-aarch64/ . | |
tar --gzip -cf ./dist/dotenvx-${{ env.CLEAN_VERSION }}-windows-amd64.tar.gz -C bin/windows-amd64/ . | |
tar --gzip -cf ./dist/dotenvx-${{ env.CLEAN_VERSION }}-windows-x86_64.tar.gz -C bin/windows-x86_64/ . | |
zip -j ./dist/dotenvx-${{ env.CLEAN_VERSION }}-windows-amd64.zip bin/windows-amd64/dotenvx.exe | |
zip -j ./dist/dotenvx-${{ env.CLEAN_VERSION }}-windows-x86_64.zip bin/windows-x86_64/dotenvx.exe | |
tar --gzip -cf ./dist/dotenvx-darwin-amd64.tar.gz -C bin/darwin-amd64/ . | |
tar --gzip -cf ./dist/dotenvx-darwin-x86_64.tar.gz -C bin/darwin-x86_64/ . | |
tar --gzip -cf ./dist/dotenvx-darwin-arm64.tar.gz -C bin/darwin-arm64/ . | |
tar --gzip -cf ./dist/dotenvx-linux-amd64.tar.gz -C bin/linux-amd64/ . | |
tar --gzip -cf ./dist/dotenvx-linux-x86_64.tar.gz -C bin/linux-x86_64/ . | |
tar --gzip -cf ./dist/dotenvx-linux-arm64.tar.gz -C bin/linux-arm64/ . | |
tar --gzip -cf ./dist/dotenvx-linux-aarch64.tar.gz -C bin/linux-aarch64/ . | |
tar --gzip -cf ./dist/dotenvx-windows-amd64.tar.gz -C bin/windows-amd64/ . | |
tar --gzip -cf ./dist/dotenvx-windows-x86_64.tar.gz -C bin/windows-x86_64/ . | |
zip -j ./dist/dotenvx-windows-amd64.zip bin/windows-amd64/dotenvx.exe | |
zip -j ./dist/dotenvx-windows-x86_64.zip bin/windows-x86_64/dotenvx.exe | |
tar --gzip -cf ./dist2/latest/dotenvx-darwin-amd64.tar.gz -C bin/darwin-amd64/ . | |
tar --gzip -cf ./dist2/latest/dotenvx-darwin-x86_64.tar.gz -C bin/darwin-x86_64/ . | |
tar --gzip -cf ./dist2/latest/dotenvx-darwin-arm64.tar.gz -C bin/darwin-arm64/ . | |
tar --gzip -cf ./dist2/latest/dotenvx-linux-amd64.tar.gz -C bin/linux-amd64/ . | |
tar --gzip -cf ./dist2/latest/dotenvx-linux-x86_64.tar.gz -C bin/linux-x86_64/ . | |
tar --gzip -cf ./dist2/latest/dotenvx-linux-arm64.tar.gz -C bin/linux-arm64/ . | |
tar --gzip -cf ./dist2/latest/dotenvx-linux-aarch64.tar.gz -C bin/linux-aarch64/ . | |
tar --gzip -cf ./dist2/latest/dotenvx-windows-amd64.tar.gz -C bin/windows-amd64/ . | |
tar --gzip -cf ./dist2/latest/dotenvx-windows-x86_64.tar.gz -C bin/windows-x86_64/ . | |
zip -j ./dist2/latest/dotenvx-windows-amd64.zip bin/windows-amd64/dotenvx.exe | |
zip -j ./dist2/latest/dotenvx-windows-x86_64.zip bin/windows-x86_64/dotenvx.exe | |
- name: update install.sh with VERSION | |
run: | | |
sed "0,/^VERSION=\".*\"/s//VERSION=\"${{ env.CLEAN_VERSION }}\"/" install.sh > ./dist/install.sh | |
sed "0,/^VERSION=\".*\"/s//VERSION=\"${{ env.CLEAN_VERSION }}\"/" install.sh > ./dist2/install.sh | |
- name: create release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
dist/*.tar.gz | |
dist/*.zip | |
dist/install.sh | |
body: "see [CHANGELOG](https://github.com/dotenvx/dotenvx/blob/main/CHANGELOG.md)" | |
env: | |
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
- name: publish checksums to release | |
uses: wangzuo/action-release-checksums@v1 | |
with: | |
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
- name: checkout dotenvx/releases repo | |
uses: actions/checkout@v4 | |
with: | |
repository: "dotenvx/releases" | |
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
path: "releases" | |
- name: copy dist2 files to release repo | |
run: | | |
mkdir -p releases/latest | |
cp -r dist2/* releases/ | |
echo "${{ env.CLEAN_VERSION }}" > releases/VERSION | |
cp README.md releases/latest/README.md | |
- name: commit and push | |
run: | | |
cd releases | |
git config --global user.name 'motdotenv' | |
git config --global user.email 'mot@dotenv.org' | |
git add . | |
git commit -m "${{ env.VERSION }}" | |
git tag "${{ env.VERSION }}" | |
git push origin HEAD --tags | |
homebrew: | |
needs: release | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
steps: | |
# https://github.com/Justintime50/homebrew-releaser | |
- name: homebrew releaser | |
uses: Justintime50/homebrew-releaser@v1 | |
with: | |
debug: false | |
homebrew_owner: dotenvx | |
homebrew_tap: homebrew-brew | |
formula_folder: Formula | |
github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
commit_owner: motdotenv | |
commit_email: mot@dotenv.org | |
install: 'bin.install "dotenvx"; bin.install_symlink "dotenvx" => "git-dotenvx";' | |
test: 'system bin/"dotenvx", "--version";' | |
target_darwin_amd64: true | |
target_darwin_arm64: true | |
target_linux_amd64: true | |
target_linux_arm64: true | |
update_readme_table: true | |
npm: | |
needs: release | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
# Setup .npmrc file to publish to npm | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '16.x' | |
registry-url: 'https://registry.npmjs.org' | |
scope: '@dotenvx' | |
- run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
docker: | |
needs: release | |
runs-on: ubuntu-latest | |
steps: | |
# GITHUB_ENV operates like a .env file | |
- name: extract version | |
run: | | |
VERSION=${GITHUB_REF#refs/tags/} | |
CLEAN_VERSION=${VERSION#v} | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
echo "CLEAN_VERSION=$CLEAN_VERSION" >> $GITHUB_ENV | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
push: true | |
tags: dotenv/dotenvx:latest | |
platforms: linux/amd64,linux/arm64 | |
- name: Build and push tag | |
uses: docker/build-push-action@v4 | |
with: | |
push: true | |
tags: dotenv/dotenvx:${{ env.VERSION }} | |
platforms: linux/amd64,linux/arm64 | |
- uses: actions/checkout@v4 | |
- name: Docker Hub Description | |
uses: peter-evans/dockerhub-description@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
repository: dotenv/dotenvx | |
short-description: ${{ github.event.repository.description }} | |
dotenvx-darwin-amd64: | |
needs: release | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: commit binary to github | |
uses: ./.github/actions/commit-binary-to-github | |
with: | |
version: ${GITHUB_REF#refs/tags/} | |
platform: darwin-amd64 | |
env: | |
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
dotenvx-darwin-arm64: | |
needs: release | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: commit binary to github | |
uses: ./.github/actions/commit-binary-to-github | |
with: | |
version: ${GITHUB_REF#refs/tags/} | |
platform: darwin-arm64 | |
env: | |
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
dotenvx-darwin-x86_64: | |
needs: release | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: commit binary to github | |
uses: ./.github/actions/commit-binary-to-github | |
with: | |
version: ${GITHUB_REF#refs/tags/} | |
platform: darwin-x86_64 | |
env: | |
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
dotenvx-linux-aarch64: | |
needs: release | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: commit binary to github | |
uses: ./.github/actions/commit-binary-to-github | |
with: | |
version: ${GITHUB_REF#refs/tags/} | |
platform: linux-aarch64 | |
env: | |
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
dotenvx-linux-amd64: | |
needs: release | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: commit binary to github | |
uses: ./.github/actions/commit-binary-to-github | |
with: | |
version: ${GITHUB_REF#refs/tags/} | |
platform: linux-amd64 | |
env: | |
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
dotenvx-linux-arm64: | |
needs: release | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: commit binary to github | |
uses: ./.github/actions/commit-binary-to-github | |
with: | |
version: ${GITHUB_REF#refs/tags/} | |
platform: linux-arm64 | |
env: | |
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
dotenvx-linux-x86_64: | |
needs: release | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: commit binary to github | |
uses: ./.github/actions/commit-binary-to-github | |
with: | |
version: ${GITHUB_REF#refs/tags/} | |
platform: linux-x86_64 | |
env: | |
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
dotenvx-windows-amd64: | |
needs: release | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: commit binary to github | |
uses: ./.github/actions/commit-binary-to-github | |
with: | |
version: ${GITHUB_REF#refs/tags/} | |
platform: windows-amd64 | |
env: | |
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
dotenvx-windows-x86_64: | |
needs: release | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: commit binary to github | |
uses: ./.github/actions/commit-binary-to-github | |
with: | |
version: ${GITHUB_REF#refs/tags/} | |
platform: windows-x86_64 | |
env: | |
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
# aggregate publish-all job to wait for all previous jobs to complete | |
publish-all: | |
runs-on: ubuntu-latest | |
needs: | |
- homebrew | |
- npm | |
- dotenvx-darwin-amd64 | |
- dotenvx-darwin-arm64 | |
- dotenvx-darwin-x86_64 | |
- dotenvx-linux-aarch64 | |
- dotenvx-linux-amd64 | |
- dotenvx-linux-arm64 | |
- dotenvx-linux-x86_64 | |
- dotenvx-windows-amd64 | |
- dotenvx-windows-x86_64 | |
steps: | |
- name: publish-all aggregate step | |
run: echo "publish-all completed" | |
dotenvx-sh: | |
needs: publish-all | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
steps: | |
- uses: actions/checkout@v4 | |
- name: extract version | |
run: | | |
VERSION=${GITHUB_REF#refs/tags/} | |
CLEAN_VERSION=${VERSION#v} | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
echo "CLEAN_VERSION=$CLEAN_VERSION" >> $GITHUB_ENV | |
- name: update install.sh with VERSION | |
run: | | |
mkdir -p dist | |
sed "0,/^VERSION=\".*\"/s//VERSION=\"${{ env.CLEAN_VERSION }}\"/" install.sh > ./dist/install.sh | |
- name: checkout dotenvx/dotenvx.sh repo | |
uses: actions/checkout@v4 | |
with: | |
repository: "dotenvx/dotenvx.sh" | |
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
path: "dotenvx.sh" | |
- name: copy install.sh to dotenvx.sh repo | |
run: | | |
cp dist/install.sh dotenvx.sh/install.sh | |
echo "${{ env.CLEAN_VERSION }}" > dotenvx.sh/VERSION | |
- name: commit and push | |
run: | | |
cd dotenvx.sh | |
git config --global user.name 'motdotenv' | |
git config --global user.email 'mot@dotenv.org' | |
git add . | |
git commit -m "${{ env.VERSION }}" --allow-empty | |
git tag "${{ env.VERSION }}" --force | |
git push origin HEAD --tags --force | |
confirm-dotenvx-sh: | |
needs: dotenvx-sh | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
steps: | |
- name: extract version | |
run: | | |
VERSION=${GITHUB_REF#refs/tags/} | |
CLEAN_VERSION=${VERSION#v} | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
echo "CLEAN_VERSION=$CLEAN_VERSION" >> $GITHUB_ENV | |
- name: wait for deployment | |
run: | | |
end=$((SECONDS+300)) | |
while [ $SECONDS -lt $end ]; do | |
current_version=$(curl -s -L https://dotenvx.sh/VERSION) | |
if [ "$current_version" == "${{ env.CLEAN_VERSION }}" ]; then | |
echo "dotenvx.sh deployment successful with version $current_version" | |
exit 0 | |
fi | |
echo "waiting for deployment..." | |
sleep 10 | |
done | |
echo "[DEPLOYMENT_FAILED]: VERSION did not update to ${{ env.CLEAN_VERSION }} within 5 minutes" | |
exit 1 | |
postrelease-ubuntu: | |
needs: confirm-dotenvx-sh | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 16.x | |
- name: sleep | |
run: sleep 60 | |
- name: install dotenvx | |
run: curl -fsS https://dotenvx.sh/ | sh | |
- name: verify version | |
run: | | |
RELEASED_VERSION=$(dotenvx --version) | |
EXPECTED_VERSION=$(node -p "require('./package.json').version") | |
echo $RELEASED_VERSION | |
echo $EXPECTED_VERSION | |
if [ "$RELEASED_VERSION" != "$EXPECTED_VERSION" ]; then | |
echo "postrelease version mismatch: expected $EXPECTED_VERSION, got $RELEASED_VERSION" | |
exit 1 | |
fi | |
- name: verify dotenvx run/get | |
run: | | |
echo "HELLO=Ubuntu" > .env | |
echo "console.log('Hello ' + process.env.HELLO)" > index.js | |
EXPECTED_MESSAGE=$(dotenvx run --quiet -- node index.js) | |
echo $EXPECTED_MESSAGE | |
if [ "$EXPECTED_MESSAGE" != "Hello Ubuntu" ]; then | |
echo "postrelease dotenvx run failure: expected Hello Ubuntu, got $EXPECTED_MESSAGE" | |
exit 1 | |
fi | |
EXPECTED_VALUE=$(dotenvx get HELLO) | |
echo $EXPECTED_VALUE | |
if [ "$EXPECTED_VALUE" != "Ubuntu" ]; then | |
echo "postrelease dotenvx get failure: expected Ubuntu, got $EXPECTED_VALUE" | |
exit 1 | |
fi | |
postrelease-mac: | |
needs: confirm-dotenvx-sh | |
runs-on: macos-latest | |
strategy: | |
fail-fast: true | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 16.x | |
- name: sleep | |
run: sleep 60 | |
- name: install dotenvx | |
run: brew install dotenvx/brew/dotenvx | |
- name: verify version | |
run: | | |
RELEASED_VERSION=$(dotenvx --version) | |
EXPECTED_VERSION=$(node -p "require('./package.json').version") | |
echo $RELEASED_VERSION | |
echo $EXPECTED_VERSION | |
if [ "$RELEASED_VERSION" != "$EXPECTED_VERSION" ]; then | |
echo "postrelease version mismatch: expected $EXPECTED_VERSION, got $RELEASED_VERSION" | |
exit 1 | |
fi | |
- name: verify dotenvx run/get | |
run: | | |
echo "HELLO=Mac" > .env | |
echo "console.log('Hello ' + process.env.HELLO)" > index.js | |
EXPECTED_MESSAGE=$(dotenvx run --quiet -- node index.js) | |
echo $EXPECTED_MESSAGE | |
if [ "$EXPECTED_MESSAGE" != "Hello Mac" ]; then | |
echo "postrelease dotenvx run failure: expected Hello Mac, got $EXPECTED_MESSAGE" | |
exit 1 | |
fi | |
EXPECTED_VALUE=$(dotenvx get HELLO) | |
echo $EXPECTED_VALUE | |
if [ "$EXPECTED_VALUE" != "Mac" ]; then | |
echo "postrelease dotenvx get failure: expected Mac, got $EXPECTED_VALUE" | |
exit 1 | |
fi | |
postrelease-windows: | |
needs: confirm-dotenvx-sh | |
runs-on: windows-latest | |
strategy: | |
fail-fast: true | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 16.x | |
- name: sleep | |
run: sleep 60 | |
- name: install dotenvx | |
run: | | |
curl -L -o dotenvx-windows-x86_64.zip https://github.com/dotenvx/releases/blob/main/latest/dotenvx-windows-x86_64.zip?raw=true | |
Expand-Archive -Path dotenvx-windows-x86_64.zip -DestinationPath .\dotenvx | |
- name: verify version | |
run: | | |
$RELEASED_VERSION = .\dotenvx\dotenvx.exe --version | |
$EXPECTED_VERSION = node -p "require('./package.json').version" | |
Write-Output "released version: $RELEASED_VERSION" | |
Write-Output "expected version: $EXPECTED_VERSION" | |
if ($RELEASED_VERSION -ne $EXPECTED_VERSION) { | |
Write-Output "postrelease version mismatch: expected $EXPECTED_VERSION, got $RELEASED_VERSION" | |
exit 1 | |
} | |
shell: pwsh | |
- name: verify dotenvx run/get | |
run: | | |
"HELLO=Windows" | Out-File -FilePath .env | |
"console.log('Hello ' + process.env.HELLO)" | Out-File -FilePath index.js | |
$EXPECTED_MESSAGE = .\dotenvx\dotenvx.exe run --quiet -- node index.js | |
Write-Output "Expected Message: $EXPECTED_MESSAGE" | |
if ($EXPECTED_MESSAGE -ne "Hello Windows") { | |
Write-Output "postrelease dotenvx run failure: expected 'Hello Windows', got '$EXPECTED_MESSAGE'" | |
exit 1 | |
} | |
$EXPECTED_VALUE = .\dotenvx\dotenvx.exe get HELLO | |
Write-Output "Expected Value: $EXPECTED_VALUE" | |
if ($EXPECTED_VALUE -ne "Windows") { | |
Write-Output "postrelease dotenvx get failure: expected 'Windows', got '$EXPECTED_VALUE'" | |
exit 1 | |
} | |
shell: pwsh |