merge pull request #17 from MRR-Group/github-actions #2
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: Docker Image Publish | |
on: | |
push: | |
branches: [ "main" ] | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v2 | |
- | |
name: Build Docker images | |
run: docker compose -f ./docker-compose.prod.yml build | |
- | |
name: Show result | |
run: docker images | |
- | |
name: Save Docker images to tar | |
run: docker save -o image.tar steam-buddy_php:latest | |
- | |
name: Pack release files into zip | |
run: zip -r steam-buddy.zip docker-compose.prod.yml docker/production/install.sh | |
- | |
name: Upload image artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: image.tar | |
path: image.tar | |
- | |
name: Upload release artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: steam-buddy.zip | |
path: steam-buddy.zip | |
release: | |
needs: [build] | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Download all artifacts | |
uses: actions/download-artifact@v2 | |
- | |
name: Display structure of downloaded files | |
run: ls -R | |
- | |
name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.sha }} | |
release_name: Steam Buddy ${{ github.sha }} | |
draft: true | |
prerelease: false' | |
- | |
name: Upload image | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: image.tar/image.tar | |
asset_name: image.tar | |
asset_content_type: application/tar | |
- | |
name: Upload release | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: steam-buddy.zip | |
asset_name: steam-buddy.zip | |
asset_content_type: application/zip |