Skip to content

0.6.0

0.6.0 #16

Workflow file for this run

name: Publish
on:
workflow_dispatch:
release:
types: [published]
env:
APP_NAME: semver
jobs:
version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.parse_version.outputs.version }}
steps:
- uses: actions/checkout@master
- uses: denoland/[email protected]
with:
deno-version: v1.x
- id: parse_version
name: Parse the Version
run: deno run -A main.ts parse
assets:
runs-on: ubuntu-latest
permissions:
contents: write
strategy:
matrix:
target:
- name: "x86_64-unknown-linux-gnu"
extension: ""
- name: "x86_64-pc-windows-msvc"
extension: ".exe"
- name: "x86_64-apple-darwin"
extension: ""
- name: "aarch64-apple-darwin"
extension: ""
needs: version
steps:
- uses: actions/checkout@master
- uses: denoland/[email protected]
with:
deno-version: v1.x
# Binaries are compiled on full Release
- name: Compile
if: github.event_name == 'release'
env:
TARGET: ${{ matrix.target.name }}
EXT: ${{ matrix.target.extension }}
run: |
deno --version
deno compile --allow-run --allow-env --allow-read --allow-write -o bin/$APP_NAME --target $TARGET main.ts
cd bin && tar -czf $APP_NAME.$TARGET.tar.gz ${APP_NAME}${EXT}
ls -la
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
if: github.event_name == 'release'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./bin/${{ env.APP_NAME }}.${{ matrix.target.name }}.tar.gz
asset_name: ${{ env.APP_NAME }}.${{ matrix.target.name }}.tar.gz
asset_content_type: application/tar+gzip
- name: Print Output
if: github.event_name == 'release'
env:
VERSION: ${{ needs.version.outputs.version }}
TARGET: ${{ matrix.target.name }}
DOWNLOAD_URL: ${{ github.event.release.download_url }}
ASSET_NAME: ${{ env.APP_NAME }}.${{ matrix.target.name }}.tar.gz
run: |
URL="https://github.com/Optum/semver-cli/releases/download/${VERSION}/${ASSET_NAME}"
SHA=$(cat ./bin/${{ env.APP_NAME}}.${{ matrix.target.name }}.tar.gz | sha256sum | cut -d " " -f1)
cat >> $GITHUB_STEP_SUMMARY<<EOF
| part | value |
| ---------- | ------------------ |
| name | \`${APP_NAME}\` |
| version | \`${VERSION}\` |
| target | \`${TARGET}\` |
| asset | [\`${ASSET_NAME}\`]($URL) |
#### formula
\`\`\`rb
url "$URL"
sha256 "$SHA"
\`\`\`
EOF
docker:
runs-on: ubuntu-latest
needs: version
steps:
- run: |
echo "Docker pushing not yet supported"
echo "Will build docker image version: ${{ needs.version.outputs.version }}"
- 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: optum/semver-cli:${{ needs.version.outputs.version }}
platforms: linux/amd64,linux/arm64