Create new extension version #15
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: Create new extension version | |
on: workflow_dispatch | |
concurrency: | |
group: ${{github.workflow}}-${{github.ref}} | |
cancel-in-progress: true | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- name: Get magyarispell | |
uses: actions/checkout@v3 | |
with: | |
repository: laszlonemeth/magyarispell | |
ref: refs/heads/master | |
fetch-depth: 1 | |
path: 'magyarispell' | |
- name: Setup environment variables | |
run: | | |
cd magyarispell | |
export ISPELL_COMMIT_HASH=$(git log -1 --pretty=format:%h) | |
export ISPELL_COMMIT_DATE=$(git log -1 --pretty=format:%ad --date=format:%Y.%m.%d.%H.%M) | |
export EXTENSION_VERSION=${ISPELL_COMMIT_DATE} | |
export EXTENSION_FILE_NAME=hungarian_dictionary-${EXTENSION_VERSION}.xpi | |
export MAGYARISPELL_FILE_NAME=MagyarIspell_${ISPELL_COMMIT_HASH}.zip | |
echo "ISPELL_COMMIT_HASH=${ISPELL_COMMIT_HASH}" >> $GITHUB_ENV | |
echo "EXTENSION_VERSION=${EXTENSION_VERSION}" >> $GITHUB_ENV | |
echo "EXTENSION_FILE_NAME=${EXTENSION_FILE_NAME}" >> $GITHUB_ENV | |
echo "MAGYARISPELL_FILE_NAME=${MAGYARISPELL_FILE_NAME}" >> $GITHUB_ENV | |
- name: Install dependencies for build | |
run: sudo apt-get install -y zip m4 recode gawk | |
- name: Build magyarispell | |
run: | | |
cd magyarispell | |
make | |
# Create packages | |
- name: Checkout tools and scripts | |
uses: actions/checkout@v3 | |
with: | |
path: tools | |
- name: Create packages | |
run: | | |
cd tools | |
export PATH=$(pwd)/tools:$PATH | |
chmod +x tools/mo | |
mkdir output | |
bash ./scripts/create_ispell_archive.sh ../magyarispell/ output/${MAGYARISPELL_FILE_NAME} | |
bash ./scripts/create_mozilla_dictionary.sh ../magyarispell/ templates/install.rdf.mustache templates/manifest.json.mustache output/${EXTENSION_FILE_NAME} | |
mkdir -p output/website | |
bash ./scripts/create_website.sh templates/ output/website/ | |
# Deploy | |
- name: Create release from generated files | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: ${{ env.EXTENSION_VERSION }} | |
tag_name: ${{ env.EXTENSION_VERSION }} | |
body: "Generated from Magyar Ispell https://github.com/laszlonemeth/magyarispell (commit hash: ${{ env.ISPELL_COMMIT_HASH }})" | |
files: | | |
./tools/output/${{ env.MAGYARISPELL_FILE_NAME }} | |
./tools/output/${{ env.EXTENSION_FILE_NAME }} | |
- name: Deploy to GitHub Pages | |
env: | |
INPUT_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
INPUT_SOURCEDIRECTORY: tools/output/website/ | |
run: | | |
wget https://raw.githubusercontent.com/crash5/ghaction-publish-ghpages/v2/entrypoint.sh | |
bash ./entrypoint.sh |