11name : Docker
22
3- # This workflow uses actions that are not certified by GitHub.
4- # They are provided by a third-party and are governed by
5- # separate terms of service, privacy policy, and support
6- # documentation.
7-
83on :
94 push :
105 branches : [ "master" ]
11- # Publish semver tags as releases.
126 tags : [ 'v*.*.*' ]
137 pull_request :
148 branches : [ "master" ]
159
1610env :
17- # Use docker.io for Docker Hub if empty
1811 REGISTRY : ghcr.io
19- # github.repository as <account>/<repo>
2012 IMAGE_NAME : ${{ github.repository }}
21-
13+ ENDPOINT : " rursache/vscode-swift-linuxserver-mod"
14+ BRANCH : " master"
2215
2316jobs :
2417 build :
@@ -27,47 +20,35 @@ jobs:
2720 permissions :
2821 contents : read
2922 packages : write
30- # This is used to complete the identity challenge
31- # with sigstore/fulcio when running outside of PRs.
3223 id-token : write
3324
3425 steps :
3526 - name : Checkout repository
3627 uses : actions/checkout@v3
37-
38- # Install the cosign tool except on PR
39- # https://github.com/sigstore/cosign-installer
28+
4029 - name : Install cosign
4130 if : github.event_name != 'pull_request'
4231 uses : sigstore/cosign-installer@9becc617647dfa20ae7b1151972e9b3a2c338a2b # v2.8.1
4332 with :
4433 cosign-release : ' v1.13.1'
4534
46-
47- # Workaround: https://github.com/docker/build-push-action/issues/461
4835 - name : Setup Docker buildx
4936 uses : docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf
5037
51- # Login against a Docker registry except on PR
52- # https://github.com/docker/login-action
5338 - name : Log into registry ${{ env.REGISTRY }}
5439 if : github.event_name != 'pull_request'
5540 uses : docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
5641 with :
5742 registry : ${{ env.REGISTRY }}
5843 username : ${{ github.actor }}
5944 password : ${{ secrets.GITHUB_TOKEN }}
60-
61- # Extract metadata (tags, labels) for Docker
62- # https://github.com/docker/metadata-action
45+
6346 - name : Extract Docker metadata
6447 id : meta
6548 uses : docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
6649 with :
6750 images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
6851
69- # Build and push Docker image with Buildx (don't push on PR)
70- # https://github.com/docker/build-push-action
7152 - name : Build and push Docker image
7253 id : build-and-push
7354 uses : docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
@@ -79,16 +60,22 @@ jobs:
7960 cache-from : type=gha
8061 cache-to : type=gha,mode=max
8162
82-
83- # Sign the resulting Docker image digest except on PRs.
84- # This will only write to the public Rekor transparency log when the Docker
85- # repository is public to avoid leaking data. If you would like to publish
86- # transparency data even for private images, pass --force to cosign below.
87- # https://github.com/sigstore/cosign
8863 - name : Sign the published Docker image
8964 if : ${{ github.event_name != 'pull_request' }}
9065 env :
9166 COSIGN_EXPERIMENTAL : " true"
9267 # This step uses the identity token to provision an ephemeral certificate
9368 # against the sigstore community Fulcio instance.
9469 run : echo "${{ steps.meta.outputs.tags }}" | xargs -I {} cosign sign {}@${{ steps.build-and-push.outputs.digest }}
70+
71+ # Dockehub
72+ - name : Login to DockerHub
73+ if : ${{ github.ref == format('refs/heads/{0}', env.BRANCH) && env.DOCKERUSER && env.DOCKERPASS && env.ENDPOINT != 'user/endpoint' }}
74+ run : |
75+ echo ${{ secrets.DOCKERPASS }} | docker login -u ${{ secrets.DOCKERUSER }} --password-stdin
76+
77+ - name : Push tags to DockerHub
78+ if : ${{ github.ref == format('refs/heads/{0}', env.BRANCH) && env.DOCKERUSER && env.DOCKERPASS && env.ENDPOINT != 'user/endpoint' }}
79+ run : |
80+ docker push ${ENDPOINT}:${{ github.sha }}
81+ docker push ${ENDPOINT}
0 commit comments