diff --git a/.github/workflows/release.yml b/.github/workflows/release-workflow.yaml similarity index 52% rename from .github/workflows/release.yml rename to .github/workflows/release-workflow.yaml index 8982046f..9ecfa159 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release-workflow.yaml @@ -1,14 +1,17 @@ -name: Publish library package to npmjs -on: - push: - tags: - - "*" +name: Scalable Pixel Streaming Frontend Release Workflow Pipeline + +# Start our pipeline when we create a new tag on the master branch +on: + release: + types: [published] + jobs: - build: + # Build NPM Package + build-npm: runs-on: ubuntu-latest defaults: run: - working-directory: ./SPS + working-directory: ./library steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 @@ -19,4 +22,4 @@ jobs: - run: npm run build - run: npm publish --access public env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/tag-workflow.yaml b/.github/workflows/tag-workflow.yaml new file mode 100644 index 00000000..d2b5a9c7 --- /dev/null +++ b/.github/workflows/tag-workflow.yaml @@ -0,0 +1,52 @@ +name: Scalable Pixel Streaming Frontend Tag Workflow Pipeline + +# Start our pipeline when we create a new tag on the master branch +on: + push: + tags: + - '*' + +# Assign an environment variable that we can use for the version of the Scalable Pixel Streaming Frontend that we are tagging +env: + VERSION: ${{ github.ref_name }} + DOCKER_USER: ${{ secrets.DOCKER_USERNAME }} + DOCKER_TOKEN: ${{ secrets.DOCKER_ACCESS_KEY }} + +jobs: + + # Build Library + build-library: + + runs-on: ubuntu-latest + + steps: + + # remove unneeded pieces from runner to free up space + - name: Free up some space + run: | + sudo rm -rf /usr/local/lib/android # will release about 10 GB if you don't need Android + sudo rm -rf /usr/share/dotnet # will release about 20GB if you don't need .NET + + # Clone the source code on the runner + - name: Clone repository + uses: actions/checkout@v3 + + # Login to Docker + - name: Docker login + run: docker login -u $DOCKER_USER -p $DOCKER_TOKEN + + # Set up Node js for npm + - name: Setup Nodejs + uses: actions/setup-node@v3 + + # Build the Scalable Pixel Streaming Frontend Library and Example + - name: Build SPS Frontend + run: | + cd ./examples/typescript + npm run build-all + + # Build the Scalable Pixel Streaming Frontend Docker image from the dist directories of the packages + - name: Build the Scalable Pixel Streaming Frontend Docker image and push to Docker + run: | + docker build -t "tensorworks/sps-frontend:$VERSION" -f ./dockerfiles/sps-frontend.dockerfile . + docker push "tensorworks/sps-frontend:$VERSION" \ No newline at end of file diff --git a/dockerfiles/sps-frontend.dockerfile b/dockerfiles/sps-frontend.dockerfile new file mode 100644 index 00000000..9284d1a6 --- /dev/null +++ b/dockerfiles/sps-frontend.dockerfile @@ -0,0 +1,11 @@ +FROM nginx:1.21.6 + +RUN mkdir www +WORKDIR /www + +ADD examples/typescript/dist/. /www/ + +RUN rm /etc/nginx/nginx.conf +RUN ln -s /etc/nginx/sps/nginx.conf /etc/nginx/nginx.conf + +EXPOSE 80 \ No newline at end of file