Release #126
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: Release | |
on: | |
schedule: | |
- cron: "0 0 * * *" # midnight UTC | |
workflow_dispatch: | |
push: | |
branches: | |
- release | |
jobs: | |
check_date: | |
runs-on: ubuntu-latest | |
name: Check latest commit | |
outputs: | |
should_run: ${{ steps.should_run.outputs.should_run }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: print latest_commit | |
run: echo ${{ github.sha }} | |
- id: should_run | |
continue-on-error: true | |
name: check latest commit is less than a day | |
if: ${{ github.event_name == 'schedule' }} | |
run: test -z $(git rev-list --after="24 hours" ${{ github.sha }}) && echo "::set-output name=should_run::false" | |
build_server: | |
strategy: | |
matrix: | |
include: | |
# - os: ubuntu-latest | |
# code-target: linux-x64 | |
- os: ubuntu-latest | |
code-target: no-server | |
# - os: macos-14 | |
# code-target: darwin-arm64 | |
# - os: macos-12 | |
# code-target: darwin-x64 | |
name: dist (${{ matrix.code-target }}) | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Set patch version | |
run: | | |
if [[ $GITHUB_REF == 'refs/heads/release' ]]; then | |
echo "version=0.1" >> $GITHUB_ENV | |
else | |
echo "version=0.2" >> $GITHUB_ENV | |
fi | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: ${{ env.FETCH_DEPTH }} | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
# - name: Use OCaml | |
# with: | |
# ocaml-compiler: 4.14.0 | |
# dune-cache: true | |
# cache-prefix: v1-${{ matrix.os }} | |
# allow-prerelease-opam: true | |
# uses: ocaml/setup-ocaml@v3 | |
# # - run: | | |
# # opam install . --deps-only | |
# # - run: LINKING_MODE=static opam exec -- dune build --profile=release | |
- run: npm ci | |
# - name: Copy server to bundle | |
# run: | | |
# cp _build/default/bin/main.exe ide/creusot-ide | |
# cp -R _opam/lib/why3 ide/why-lib | |
# cp -R _opam/share/why3 ide/why-data | |
# if: matrix.code_target != 'no-server' | |
- run: mkdir dist | |
- name: Set Version Number | |
run: | | |
echo "Preparing version: ${{env.version}}.${{github.run_number}}" | |
node -e "var p = require('./package.json'); console.log(JSON.stringify({...p, version: '${{ env.version }}.${{ github.run_number }}' }))" > ./package.nightly.json | |
mv package.nightly.json package.json | |
- name: Package | |
run: npx vsce package -o "./dist/creusot-ide-${{ matrix.code-target }}.vsix" --target ${{ matrix.code-target }} | |
if: github.ref == 'refs/heads/release' && matrix.code-target != 'no-server' | |
- name: Package (Nightly) | |
run: npx vsce package -o "./dist/creusot-ide-${{ matrix.code-target }}.vsix" --target ${{ matrix.code-target }} --pre-release | |
if: github.ref != 'refs/heads/release' && matrix.code-target != 'no-server' | |
# Publish fallback | |
- if: matrix.code-target == 'no-server' && github.ref == 'refs/heads/release' | |
run: npx vsce package -o ./dist/creusot-ide-no-server.vsix | |
- if: matrix.code-target == 'no-server' && github.ref != 'refs/heads/release' | |
run: npx vsce package -o ./dist/creusot-ide-no-server.vsix --pre-release | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.code-target }} | |
path: ./dist | |
publish: | |
needs: [build_server,check_date] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Nodejs | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: ${{ env.FETCH_DEPTH }} | |
# - uses: actions/download-artifact@v4 | |
# with: | |
# name: darwin-arm64 | |
# path: dist | |
# - uses: actions/download-artifact@v4 | |
# with: | |
# name: darwin-x64 | |
# path: dist | |
- uses: actions/download-artifact@v4 | |
with: | |
name: no-server | |
path: dist | |
# - uses: actions/download-artifact@v4 | |
# with: | |
# name: linux-x64 | |
# path: dist | |
- run: ls -al ./dist | |
- run: npm ci | |
- name: Publish Extension (Code Marketplace, nightly) | |
if: github.ref != 'refs/heads/release' && needs.check_date.outputs.should_run != 'true' | |
run: npx vsce publish --pat ${{ secrets.MARKETPLACE_TOKEN }} --packagePath ./dist/creusot-ide-*.vsix | |
# TODO(xavier): Get token on OpenVSX | |
# - name: Publish Extension (OpenVSX, nightly) | |
# if: github.ref != 'refs/heads/release' && needs.check_date.outputs.should_run != 'true' | |
# working-directory: ./ide | |
# run: npx ovsx publish --pat ${{ secrets.OPENVSX_TOKEN }} --packagePath ./dist/creusot-ide-*.vsix | |
# timeout-minutes: 2 | |
- name: Publish Extension (Code Marketplace) | |
if: github.ref == 'refs/heads/release' | |
run: npx vsce publish --pat ${{ secrets.MARKETPLACE_TOKEN }} --packagePath ./dist/creusot-ide-*.vsix | |
# - name: Publish Extension (OpenVSX) | |
# if: github.ref == 'refs/heads/release' | |
# working-directory: ./ide | |
# run: npx ovsx publish --pat ${{ secrets.OPENVSX_TOKEN }} --packagePath ./dist/creusot-ide-*.vsix | |
# timeout-minutes: 2 | |
# - name: Release | |
# - name: Release | |
# uses: softprops/action-gh-release@v1 |