Skip to content

Move codespell config to pyproject.toml (#333) #304

Move codespell config to pyproject.toml (#333)

Move codespell config to pyproject.toml (#333) #304

Workflow file for this run

name: Build and Release Salam
on:
push:
branches:
- main
jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies
run: sudo apt-get install build-essential
- name: 'GCC Version'
run: |
gcc --version
- name: Build salam for Linux
run: |
make run
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: salam-linux
path: salam
build-macos:
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: 'GCC Version'
run: |
gcc --version
- name: Build salam for macOS
run: |
make run
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: salam-macos
path: salam
build-windows:
runs-on: windows-latest
defaults:
run:
shell: bash
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: 'GCC Version'
run: |
gcc --version
- name: Build salam.exe for Windows
run: |
build-windows.bat
shell: cmd
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: salam-windows
path: salam.exe
create-release:
if: |
startsWith(github.event.head_commit.message, 'release:') &&
github.repository == 'SalamLang/Salam'
runs-on: ubuntu-latest
needs: [build-linux, build-macos, build-windows]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Read version from VERSION file
id: get_version
run: |
VERSION=$(cat VERSION | sed 's/^[ \t]*//;s/[ \t]*$//')
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo "Salam version: ${VERSION}"
- name: Download Linux artifact
uses: actions/download-artifact@v4
with:
name: salam-linux
path: ./release
- name: Rename Linux binary to avoid conflict
run: |
mv ./release/salam ./release/salam-linux
- name: Download macOS artifact
uses: actions/download-artifact@v4
with:
name: salam-macos
path: ./release
- name: Rename macOS binary to avoid conflict
run: |
mv ./release/salam ./release/salam-mac
- name: Download Windows artifact
uses: actions/download-artifact@v4
with:
name: salam-windows
path: ./release
- name: Rename Window binary
run: |
mv ./release/salam.exe ./release/salam-windows.exe
- name: Post Linux release file to SERVER_VERSIONS_API
run: |
curl -X POST "${{ secrets.SERVER_VERSIONS_API }}" \
-F "file=@./release/salam-linux" \
-F "version=${{ env.VERSION }}" \
-F "date=$(date +'%Y-%m-%d')" \
-F "time=$(date +'%H:%M:%S')" \
-F "key='${{ secrets.SERVER_VERSIONS_KEY }}'" \
-F "platform=linux"
- name: Post macOS release file to SERVER_VERSIONS_API
run: |
curl -X POST "${{ secrets.SERVER_VERSIONS_API }}" \
-F "file=@./release/salam-mac" \
-F "version=${{ env.VERSION }}" \
-F "date=$(date +'%Y-%m-%d')" \
-F "time=$(date +'%H:%M:%S')" \
-F "key='${{ secrets.SERVER_VERSIONS_KEY }}'" \
-F "platform=macos"
- name: Post Windows release file to SERVER_VERSIONS_API
run: |
curl -X POST "${{ secrets.SERVER_VERSIONS_API }}" \
-F "file=@./release/salam-windows.exe" \
-F "version=${{ env.VERSION }}" \
-F "date=$(date +'%Y-%m-%d')" \
-F "time=$(date +'%H:%M:%S')" \
-F "key='${{ secrets.SERVER_VERSIONS_KEY }}'" \
-F "platform=windows"
- name: Set up GitHub CLI
run: sudo apt-get install gh -y
- name: Authenticate GitHub CLI
run: gh auth login --with-token <<< ${{ secrets.GITHUB_TOKEN }}
- name: Delete existing release and tag if found
run: |
VERSION="v${{ env.VERSION }}"
if gh release view "$VERSION" > /dev/null 2>&1; then
echo "Release $VERSION exists. Deleting release..."
gh release delete "$VERSION" --yes
else
echo "Release $VERSION does not exist."
fi
if git rev-parse "$VERSION" >/dev/null 2>&1; then
echo "Tag $VERSION exists locally. Deleting tag..."
git tag -d "$VERSION" || true
else
echo "Tag $VERSION does not exist locally."
fi
if git ls-remote --tags origin | grep "refs/tags/$VERSION" >/dev/null 2>&1; then
echo "Tag $VERSION exists on remote. Deleting remote tag..."
git push origin :refs/tags/"$VERSION" || true
else
echo "Tag $VERSION does not exist on remote."
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create new Git tag
run: |
git tag v${{ env.VERSION }}
git push origin v${{ env.VERSION }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create new GitHub Release and Tag
uses: softprops/action-gh-release@v2
with:
tag_name: 'v${{ env.VERSION }}'
name: 'Salam Release v${{ env.VERSION }}'
body: 'This release includes the latest build for Linux, macOS, and Windows.'
files: |
release/salam-linux
release/salam-mac
release/salam-windows.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}