Create and publish a Docker image #70
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 and publish a Docker image | |
# Configures this workflow to run every time a change is pushed to the branch called `release`. | |
on: | |
push: | |
branches: ['samsung_wasm'] | |
schedule: | |
- cron: '0 12 15 * *' # Run every 15th of the month at 12:00 PM | |
# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds. | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu. | |
jobs: | |
build-and-push-image: | |
runs-on: ubuntu-latest | |
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job. | |
permissions: | |
contents: read | |
packages: write | |
outputs: | |
image_tag: ${{ steps.meta.outputs.tags }} | |
short_sha: ${{ github.sha }} | |
# | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
# Uses the `docker/login-action` action to log in to the Container registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here. | |
- name: Log in to the Container registry | |
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels. | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages. | |
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository. | |
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step. | |
- name: Build and push Docker image | |
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: Trigger Artifact Workflow | |
run: | | |
curl -X POST \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
-H "Authorization: token ${{ secrets.PAT }}" \ | |
https://api.github.com/repos/${{ github.repository }}/dispatches \ | |
-d '{"event_type":"artifact_workflow", "client_payload": {"image_tag": "${{ steps.meta.outputs.tags }}"}}' | |
run-and-upload: | |
runs-on: ubuntu-latest | |
needs: build-and-push-image | |
steps: | |
- name: Set up image tag | |
run: echo "IMAGE_TAG=ghcr.io/oneliberty/moonlight-chrome-tizen:${{ github.ref_name }}" >> $GITHUB_ENV | |
- name: Run Docker container | |
run: docker run -d --name temp_container $IMAGE_TAG | |
- name: Copy artifacts from Docker container | |
run: | | |
docker cp temp_container:/home/moonlight/Moonlight.wgt . && docker cp temp_container:/home/moonlight/MoonlightUSB.zip . | |
- name: Stop and remove Docker container | |
run: | | |
docker stop temp_container && docker rm temp_container | |
- name: Upload artifact Moonlight.wgt | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Moonlight.wgt | |
path: Moonlight.wgt | |
retention-days: 0 | |
- name: Upload artifact MoonlightUSB.zip | |
uses: actions/upload-artifact@v4 | |
with: | |
name: MoonlightUSB.zip | |
path: MoonlightUSB.zip | |
retention-days: 0 | |
- name: Create GitHub Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref_name }}-${{ github.run_id }} | |
release_name: "Release ${{ github.ref_name }}-${{ github.run_id }}" | |
body: | | |
# Instructions for Installing Moonlight on Your TV: | |
- Ensure that your TV is running on Tizen version 5.5 or higher. | |
- For a persistent installation, follow the instructions in the [README.md](https://github.com/OneLiberty/moonlight-chrome-tizen?tab=readme-ov-file#getting-started), this will require docker. | |
- Alternatively, you can use the MoonlightUSB.zip to install it (you'll have to redo it every month): | |
- Download the MoonlightUSB.zip file. | |
- Extract the contents of the zip file to the root directory of your USB key. | |
- The structure for your USB Drive should be as follows: | |
``` | |
root/ | |
├── userwidget/ | |
├── app.tmg | |
├── widget.license | |
``` | |
- Insert the USB key into your TV's USB port. | |
- Wait for the installation process to complete. (This can take some time) | |
> [!NOTE] | |
> Please note that this installation method may or may not be persistent. For a more reliable installation, it's recommended to use the Docker install method if possible. | |
## Support and discussion. | |
You can support the project by donating on [BuyMeACoffee](https://buymeacoffee.com/oneliberty). | |
Discuss about the release over on the [discord server](https://discord.gg/zHafSd3bTw)! | |
draft: false | |
prerelease: false | |
- name: Upload Moonlight.wgt to Release | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./Moonlight.wgt | |
asset_name: Moonlight.wgt | |
asset_content_type: application/octet-stream | |
- name: Upload MoonlightUSB.zip to Release | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./MoonlightUSB.zip | |
asset_name: MoonlightUSB.zip | |
asset_content_type: application/octet-stream |