⚙️ bump to 3.3.8 #367
This file contains hidden or 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: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| jobs: | |
| version_check: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| should_update: ${{ steps.outputs.outputs.should_update }} | |
| version: ${{ steps.outputs.outputs.version }} | |
| previous_version: ${{ steps.get_latest_tag.outputs.tag }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Get version | |
| id: get_version | |
| run: | | |
| echo "version=$(grep -oP '(?<=version: ")[^"]*' config.yml)" >> $GITHUB_OUTPUT | |
| - name: Get latest version tag | |
| id: get_latest_tag | |
| uses: WyriHaximus/github-action-get-previous-tag@v2 | |
| with: | |
| pattern: v* | |
| fallback: 0.0.0 | |
| - name: Compare versions | |
| id: compare_versions | |
| run: | | |
| echo "should_update=$(python3 -c "from packaging import version; print(version.parse('${{ steps.get_version.outputs.version }}') > version.parse('${{ steps.get_latest_tag.outputs.tag }}'))")" >> $GITHUB_OUTPUT | |
| - name: Set outputs | |
| id: outputs | |
| if: steps.compare_versions.outputs.should_update == 'True' | |
| run: | | |
| echo "should_update=True" >> $GITHUB_OUTPUT | |
| echo "version=${{ steps.get_version.outputs.version }}" >> $GITHUB_OUTPUT | |
| create_release: | |
| needs: version_check | |
| if: needs.version_check.outputs.should_update == 'True' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: main | |
| - name: Get Changelog | |
| id: get_changelog | |
| run: | | |
| { | |
| echo 'changelog<<CHANGELOG_EOF' | |
| git log -1 --pretty=format:"%b" | |
| echo "" | |
| echo 'CHANGELOG_EOF' | |
| } >> "$GITHUB_OUTPUT" | |
| - name: Create release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: v${{ needs.version_check.outputs.version }} | |
| body: | | |
| ${{ steps.get_changelog.outputs.changelog }} | |
| Full Changelog: ${{ github.server_url }}/${{ github.repository }}/compare/${{ needs.version_check.outputs.previous_version }}...v${{ needs.version_check.outputs.version }} | |
| - name: Send changelog to Discord | |
| uses: tsickert/discord-webhook@v5.3.0 | |
| with: | |
| webhook-url: ${{ secrets.WEBHOOK_URL }} | |
| content: | | |
| # Version ${{ needs.version_check.outputs.version }} | |
| <@&${{ secrets.WEBHOOK_ROLE }}> | |
| ${{ steps.get_changelog.outputs.changelog }} | |
| publish_images: | |
| needs: [version_check, create_release] | |
| if: needs.version_check.outputs.should_update == 'True' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: main | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Extract Docker metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: | | |
| ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPO_NAME }} | |
| ghcr.io/${{ github.repository }} | |
| tags: | | |
| type=raw,value=latest | |
| type=semver,pattern={{version}},value=${{ needs.version_check.outputs.version }} | |
| type=semver,pattern={{major}}.{{minor}},value=${{ needs.version_check.outputs.version }} | |
| type=semver,pattern={{major}},value=${{ needs.version_check.outputs.version }} | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| platforms: linux/amd64,linux/arm64,linux/arm/v7 | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| deployment: | |
| needs: [version_check, create_release] | |
| if: needs.version_check.outputs.should_update == 'True' | |
| runs-on: self-hosted | |
| steps: | |
| - name: Set up context | |
| run: | | |
| echo "VIRTUAL_ENV=${{ secrets.VENV_DIRECTORY }}" >> $GITHUB_ENV | |
| echo "${{ secrets.VENV_DIRECTORY }}/bin" >> $GITHUB_PATH | |
| - name: Stop | |
| run: | | |
| pm2 stop ${{ secrets.PM2_PROCESS_NAME }} | |
| - name: Reset local environment | |
| run: | | |
| rm -f log.txt | |
| git reset --hard | |
| git clean -fd | |
| working-directory: ${{ secrets.DIRECTORY }} | |
| - name: Checkout | |
| run: | | |
| git fetch --all --tags | |
| git checkout refs/tags/v${{ needs.version_check.outputs.version }} | |
| working-directory: ${{ secrets.DIRECTORY }} | |
| - name: Install dependencies | |
| run: | | |
| pip install --force-reinstall -r requirements.txt | |
| working-directory: ${{ secrets.DIRECTORY }} | |
| - name: Migrate database | |
| run: | | |
| masonite-orm migrate -C database/config.py -d database/migrations | |
| working-directory: ${{ secrets.DIRECTORY }} | |
| - name: Start | |
| run: | | |
| pm2 start ${{ secrets.PM2_PROCESS_NAME }} |