Skip to content

nightly

nightly #413

Workflow file for this run

name: nightly
on:
workflow_dispatch:
inputs:
release_name:
type: string
description: Release name, defaults to `nightly`
tag_name:
type: string
description: Tag name, defaults to `nightly-YYYYMMDD`, or release name if specified
prerelease:
type: boolean
default: true
description: "Is this a prerelease?"
schedule:
- cron: "0 4 * * *"
env:
CARGO_TERM_COLOR: always
concurrency:
group: ci-nightly
cancel-in-progress: true
jobs:
check:
runs-on: ubuntu-latest
outputs:
skip: ${{ steps.check_changes.outputs.skip }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check for changes
id: check_changes
run: |
if [ "$(git log $(git describe --tags --abbrev=0)..HEAD --oneline)" = "" ]; then
echo "skip=true" >> "$GITHUB_OUTPUT"
fi
tag:
needs: check
if: needs.check.outputs.skip != 'true'
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
tag: ${{ steps.output_tag.outputs.tag }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Compute tag
run: echo "TAG=${{ inputs.tag_name || inputs.release_name || 'nightly-$(date +"%Y%m%d")' }}" >> "$GITHUB_ENV"
- name: Create tag
id: create_tag
run: git tag -f ${{ env.TAG }} && git push --tags
- name: Output tag
id: output_tag
run: echo "tag=${{ env.TAG }}" >> "$GITHUB_OUTPUT"
build:
needs: [check, tag]
runs-on: ${{ matrix.runs-on }}
if: needs.check.outputs.skip != 'true'
strategy:
fail-fast: false
matrix:
include:
- runs-on: ubuntu-latest
target: x86_64-unknown-linux-gnu
- runs-on: ubuntu-latest
target: i686-unknown-linux-gnu
- runs-on: ubuntu-latest
target: x86_64-unknown-linux-musl
- runs-on: macos-latest
target: x86_64-apple-darwin
- runs-on: macos-latest
target: aarch64-apple-darwin
- runs-on: windows-latest
target: x86_64-pc-windows-msvc
- runs-on: windows-latest
target: i686-pc-windows-msvc
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-tags: true
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
target: ${{ matrix.target }}
- name: Additional setup for musl
if: contains(matrix.target, 'musl')
run: |
sudo apt-get update
sudo apt-get install -y musl-tools
- name: Additional setup for Linux x86
if: matrix.target == 'i686-unknown-linux-gnu'
run: |
sudo apt-get update
sudo apt-get install -y gcc-multilib
- name: Build
run: cargo build --release --target ${{ matrix.target }}
- name: Zip files
shell: bash
run: |
if [ "${{ matrix.runs-on }}" = "windows-latest" ]; then
mv ./target/${{ matrix.target }}/release/odoo-lsp.exe .
7z a -tzip odoo-lsp-${{ matrix.target }}.zip ./odoo-lsp.exe
else
mv ./target/${{ matrix.target }}/release/odoo-lsp .
tar -czvf odoo-lsp-${{ matrix.target }}.tgz odoo-lsp
fi
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
path: ./odoo-lsp-${{ matrix.target }}.${{ matrix.runs-on == 'windows-latest' && 'zip' || 'tgz' }}
name: odoo-lsp-${{ matrix.target }}.${{ matrix.runs-on == 'windows-latest' && 'zip' || 'tgz' }}
build-extension:
needs: [check, tag]
runs-on: ubuntu-latest
if: needs.check.outputs.skip != 'true'
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-tags: true
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup Node.js
uses: actions/setup-node@v3
with:
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- run: pnpm install
- name: Inject custom release name
if: "${{ inputs.release_name != '' }}"
run: |
cat package.json | jq '. +{"_release":"${{ inputs.release_name }}"}' > __temp__
mv __temp__ package.json
- run: pnpm package
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
path: ./odoo-lsp-*.vsix
name: odoo-lsp-extension.vsix
untag:
needs: [build, build-extension, tag]
if: always() && (needs.build.result != 'success' || needs.build-extension.result != 'success') && needs.check.outputs.skip != 'true'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-tags: true
- name: Remove tag
run: git tag -d ${{ needs.tag.outputs.tag }} && git push origin :${{ needs.tag.outputs.tag }}
release:
name: Create Release
runs-on: ubuntu-latest
needs: [build, build-extension, tag]
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 5
fetch-tags: true
- name: Download artifacts
uses: actions/download-artifact@v3
- name: Generate checksums
run: |
for file in odoo-lsp-*/odoo-lsp-*; do
openssl dgst -sha256 -r "$file" | awk '{print $1}' > "${file}.sha256";
done
- name: Setup git-cliff
uses: taiki-e/install-action@v2
with:
tool: git-cliff
- name: Generate release notes
run: |
if [[ '${{ needs.tag.outputs.tag }}' == 'nightly-'* ]]; then
./scripts/nightly-changelog > ${{ github.workspace }}-CHANGELOG.txt
else
git cliff -l > ${{ github.workspace }}-CHANGELOG.txt
fi
- name: Release
uses: softprops/action-gh-release@v1
with:
files: odoo-lsp-*/odoo-lsp-*
name: ${{ inputs.release_name || 'nightly' }}
tag_name: ${{ needs.tag.outputs.tag }}
body_path: ${{ github.workspace }}-CHANGELOG.txt
prerelease: ${{ github.event_name != 'workflow_dispatch' || inputs.prerelease }}